Thursday, May 1, 2014

[GEEK SCHOOL] Windows Admin 4: Understanding Hard Drive Partitioning with Disk Management

clip_image001


In today’s edition of Geek School, we’re going to talk about how to use Disk Management… but we’re going to go one step further and explain master boot records, partition tables, and dynamic disks.


The Disk Management utility seems fairly simple at first glance. There’s a list of your hard drives combined with a graphical representation of the partitions on each one. You can create and edit partitions… but there is a lot more to do. You can create Spanned, Striped, or Mirrored volumes across multiple disks, or you can create and attach virtual hard drives.


If you dig a little deeper, you will find that you can switch your hard drives between MBR (Master Boot Record) and GPT (Guid Partition Table) as the partition scheme, and then you can specify whether to use Basic (the default) partitions, or to use “Dynamic”, which is a special method to allow Windows to handle the partitioning.


Confused? Keep reading and we’ll try to explain it in a way that everybody can understand.


Understanding the Interface


When you first launch Disk Management (which can be done through right-clicking on the Start button in Windows 8.1 or the Computer icon in Windows 7 and selecting “Manage”), you’ll be presented with a two-pane interface. The list of volumes is on top, and the list of physical drives is on the bottom.


The bottom panel shows not just the list of physical drives, but a graphical representation of the partitions, or volumes, on each drive, including a bunch of useful information.


clip_image002


In the screenshot above, you’ll notice that the drives have extra information displayed – you can see that the C: drive is the Boot drive, while the System Reserved partition is the Active one. Both partitions are Primary. That System Reserved partition actually contains the boot files, so the BIOS for the computer initially boots from that partition, and then Windows loads through the C: partition.


If you either select a drive or a partition and use the Action menu, you’ll see a list of most of the options, including how to create a spanned, striped, or mirrored volume, and how to switch between MBR / GPT disk type, or Basic / Dynamic. We’ll explain that stuff shortly.


clip_image003


If you right-click on a partition, you’ll see a different list of actions – you can change the drive letter or path for a drive (more on that later), or you can shrink / extend the volume, format it, add a mirror, or delete it.


clip_image004


We’ll mention this again later, but it’s worth noting right away: Software RAID, as in mirroring, striping, or spanning, is not something you want to do if you have a choice. It’s always better to go with hardware RAID instead. It’s important to understand partitioning though.


Initializing a Disk and Choosing a Partition Style


clip_image005


Have you ever inserted a drive into your PC only to be presented with a dialog asking you to Initialize Disk?


What’s actually going on is that Windows didn’t detect any partition table format, so it will ask you to “Initialize”, which really just means write out a new blank partition table. In modern versions of Windows, that means you’ll get a choice between MBR and GPT.


Note: just because Windows didn’t recognize any partition information doesn’t mean that your drive is blank. If you know that the drive works, it’s possible that you are having a driver issue, or in some cases, if you plugged in an external drive, you can remove and then plug it back in again. Of course, if you selected GPT as the partition table, it’s also possible that the PC’s BIOS can’t handle it.


Using MBR (Master Boot Record)


If you are formatting a drive that you plan to plug into different computers, it would generally need to use the MBR partition “style” because it’s a really old format that works everywhere, because any computer with a regular BIOS has support for hard drives partitioned using MBR.


Modern computers using UEFI are going away from MBR support and switching instead to the newer and better replacement known as GPT (Guid Partition Table), because MBR has a number of issues and limitations.


One of these limitations is that MBR only supports up to 4 primary partitions. If you want to use more than 4 partitions, you need to set the fourth partition as an “Extended” primary partition, which can then house “Logical” partitions within it. Thankfully all of this happens behind the scenes in Disk Management these days, but from a technology standpoint, it isn’t the best way to handle things, and has some weird compatibility issues.


clip_image006

Notice the logical partitions in brighter blue, while the extended partition is green.



The next limitation is that partitions using the MBR format have a maximum size of 2 TiB, which is significantly less than what you can get from modern hard drives, and especially from what you can do with a hardware RAID using a couple of 2 or 3 TB hard drives.


This limitation stems from the fact that there is a 32-bit list of sectors, and hard drives typically have 512 bytes per sector. So 512 * 2^32 = 2 TiB, and thus you’ll always read that MBR partitions have that limit.


The good news is that there is a workaround should you need one. If you have one of the newer hard drives that use 4k sectors, the actual theoretical limit is 16 TiB instead, since 4096 * 2^32 = 16 TiB. Realistically, however, it would be better to just migrate to GPT partitions instead, which have no such limitations.


Using GPT (Guid Partition Table)


The newer GPT partition table “style” is required on your boot drive by newer computers that use UEFI instead of BIOS – while some of them support a “legacy BIOS” mode to handle booting the older style, you would generally just use GPT instead.


Since Windows Vista, you can generally use GPT partitions on a data drive for a computer that uses a newer version of BIOS, but you can’t use them as a bootable drive. And 32-bit Windows XP doesn’t support it from all the documentation we’ve ever read.


clip_image007

None of that “Extended” or “Logical” partition nonsense on a GPT drive.



GPT supports up to 128 partitions on the same hard drive, and each partition can be 9.4 zettabytes, which is 1 billion terabytes, which is a somewhat ridiculous number in today’s terms. Rather than just storing a single copy of the partition table the way MBR does, there is both a primary and backup copy, and they have cyclic redundancy checks to validate against data corruption.


All GPT disks contain a “Protective MBR” at the beginning of the drive, which is basically a fake MBR at the beginning of the drive where an old-school MBR drive would put it… and the fake partition table shows the entire drive as having a single partition. This protects you against older tools breaking your drive because they don’t have GPT support. It does not, however, make the file system readable on older computers.


Bootable GPT drives require a couple of things. First, you’ll need an EFI System Partition, which is at least 100-260 MB depending on your drive, and that partition will contain the boot loader and other information.


To better understand the difference between MBR and GPT, we found this graphic buried deep within the Microsoft documentation and decided to display it here for you as well. Notice the LDM data partition stuff, which we are going to cover in a moment.


clip_image009


You can actually switch back and forth between MBR and GPT partition types by right-clicking on the drive in Disk Management. The problem is that before you do, you’ll need to delete all of the partitions on the disk, which does make the feature slightly less useful.


Choosing a Disk Type: Basic or Dynamic


clip_image010


One of the other concepts in Disk Management is the very confusing “Dynamic” disk instead of the default “Basic” disk. What makes this more confusing is that you can also choose between MBR and GPT Disk on the same menu.


When you create a disk using either MBR or GPT partition formatting, you can create regular partitions using the MBR or GPT specification. For MBR that would be a choice between the Primary and Extended / Logical partitions, and for GPT it would just be regular Guid partitions. Windows refers to this as a “Basic” disk.


The other option in Windows is to use a “Dynamic Disk”, which allows Windows to take control of your partitioning rather than using the partitioning specifications. These are called Volumes rather than partitions (in fact, Windows always refers to either type of partition as a volume).


What happens behind the scenes is that Windows creates a regular MBR or GPT partition structure that fills the entire drive, and then Windows will allow you to manage the “Volumes” on that drive, which act like partitions, and even provide extra features. Because Dynamic Disks are still reliant on the underlying MBR or GPT structure, you should choose between them wisely – if you need a huge drive, GPT is probably the way to go.


Windows uses the Logical Disk Manager (LDM) database to store the volume types, drive letters, and all of the other information, and it even replicates this database to every dynamic drive on your computer for backup. On an MBR drive, this data is stored in the last 1 MB on the drive, and in a GPT drive, Windows will create a 1 MB hidden partition called the LDM metadata partition.


Mirroring Your System Drive


You can easily convert your system drive to a dynamic disk in order to mirror it. All you have to do is start the mirroring wizard by right-clicking on your system drive and choosing Add Mirror.


clip_image011


You will be prompted to convert the disks to dynamic instead of Basic, and given a warning that you can’t boot any other operating systems. That’s right, dynamic disks break dual-booting scenarios.


clip_image012


Once you’ve configured the mirror, your computer will slow down to a crawl as all of the data from your system drive is copied over to the other drive. From that moment on, your data should stay in sync on both drives.


clip_image013


You can right-click on the mirrored drives to either “break” the mirror, which will stop mirroring but leave everything alone on each drive, or you can remove the mirror.


Note: You can’t mirror an MBR drive to a GPT drive.


Types of Volumes for Dynamic Disks


When you are working with a volume on a Dynamic Disk, you can choose to extend or span that volume across multiple drives, you can stripe or mirror, or in server editions you can even use RAID 5. There’s also not a real limit on the number of volumes you can have, although it wouldn’t make sense to have a huge number of them.


Here are the types of volumes you can create on a Dynamic Disk:



  • Simple Volume – this is a regular “partition”. If the disk type is “Basic”, this creates an actual partition.

  • Striped Volume – data is striped across multiple hard drives so that every other segment of data is staggered between the drives for maximum performance. There is no redundancy.

  • Spanned Volume – data fills up on one drive and then fills up the next drive as it gets more full. Two or more drives are basically taped together to make a bigger disk. There is no redundancy here either.

  • Mirrored Volume – for home users, this is the only form of redundancy that you will get with software options. Read performance should be faster, but write performance will possibly be slightly slower, since Windows has to write to both drives for everything.

  • RAID5 Volume – only works on server editions, but it can stripe across 3 or more hard drives and include a parity stripe to prevent data loss if a drive was to fail.


Note: you can’t use a Dynamic Disk for a removable / portable drive.


Windows 8 Changes Everything


One of the most interesting features in Windows 8 is a feature called Storage Spaces, which completely replaces Disk Management and all of this required knowledge for an extremely easy to use system that gives you RAID-like functionality for your data drives.


You can’t use Storage Spaces for your boot drive, but using it is a snap – and it supports redundancy, so if one of your hard drives dies, you won’t lose everything.


To access it, head into Control Panel and search for Storage Spaces. Then click on the “Create a new pool and storage space”.


clip_image014


Once you select the drives on the next screen, click the Create pool option.


clip_image015


You can select from a number of options and then create the storage pool. The interesting thing is that once you’ve done so, it will actually report to Disk Management as if it was a single drive – the same way that hardware RAID would do.


clip_image016


We said it earlier, and we’ll say it again: You should always try and invest in hardware RAID if you can rather than use software substitutes. But isn’t it great to learn something new?


Mounting Volumes as Drive Letters or Folders


One last thing before we go: you can change the mount point for any drive except your system drive by right-clicking, and then selecting “Change Drive Letter and Paths” from the menu. From this dialog you can either change the drive letter, or you can even add a path to a folder on your drive, and the partition will be mounted into that folder, just like on Linux.


clip_image017


This is a really great way to add more space to your system without having to move things around to the D: drive or use symlinks – just mount your second drive into your user folder.


What Else?


You can also create a VHD (virtual hard drive) file and mount it as a drive letter – it’s a lot like mounting an ISO image. You can expand and shrink partitions, although it doesn’t work all that well in Disk Management.


You can also access all of the same commands, and a lot more, using the command-line diskpart.exe utility. It’s extremely powerful, and we didn’t have time to get to it today, but we’ll talk about it in a future lesson.


And if you want to format your hard drives, and you aren’t sure which format to pick, you should probably just stick with NTFS.


















No comments:

Post a Comment