Partitions and Volumes
In Windows Server 2008 the distinction between volumes and partitions is somewhat murky. When using Disk Management, a regular partition on a basic disk is called a simple volume, even though technically a simple volume requires that the disk be a dynamic disk.
As long as you use only simple volumes or partitions, you can easily convert between a basic disk (and partition) and a dynamic disk (and a volume). Once you use a feature that is supported only on dynamic disks, however, changing back to a basic disk will mean data loss. Any operation that would require conversion to a dynamic disk will give you fair warning, as shown in Figure 19-6.
Figure 19-6 Disk Management will warn you before any operation that would cause a conversion to dynamic disks.
When using Disk Management, the conversion to dynamic disks as required happens automatically. When using DiskPart, however, you need to explicitly specify each step of the process.
Creating a Volume or Partition
You can create a new volume or partition on any disk that has empty space. If the disk is dynamic, a volume is created. If the disk is a basic disk, a primary partition is created. If the empty space is part of an extended partition, a new logical drive will be created. All of them called a simple volume, but each one a different structure.
Note You can no longer create an extended partition in Disk Manager. If you need to create an extended partition, you need to use DiskPart.exe. But there's really no longer any need for extended partitions.
To create a new volume or partition, follow these steps:
In Disk Management, right-click the unallocated disk and select the type of volume to create, as shown in Figure 19-7. Click Next.
Figure 19-7 Creating a volume
Depending on the number of available unallocated volumes, you see one or more options for the type of volume, including the following:
- New Simple Volume
- New Spanned Volume
- New Striped Volume
- New Mirrored Volume
- New RAID-5 Volume
Select the type you want to create. The New Volume Wizard for that specific type of volume will open. Figure 19-8 shows the New RAID-5 Volume Wizard.
Figure 19-8 The New RAID-5 Volume Wizard
Select the disks to use for the new volume. The choices available and the selections you need to make depend on the type of volume you're creating and the number of available unallocated disks. Figure 19-9 shows a RAID-5 volume being created.
Figure 19-9 Select the disks that will be part of this volume.
On the same page, adjust the size of the new volume. By default, the new volume will use the maximum available space from each of the selected disks. For spanned volumes, this will be the sum of the free space on the selected disks; for other types of volumes, it will be the number of disks multiplied by the available space on the smallest of the selected disks. Click Next.
Select either a drive letter or a mount point for the new volume, as shown in Figure 19-10, or opt not to assign a drive letter or path at this time. With Windows Server 2008, you can "mount" a volume on an empty subdirectory, minimizing the number of drive letters and reducing the complexity of the storage that is displayed to the user. If you want to take advantage of this feature, click Browse to locate the directory where you will mount the new volume. Click Next. (See the Real World sidebar "Mounted Volumes" for more about this subject.)
Figure 19-10 Select a drive letter or mount point for the new volume.
Select the formatting options you want (shown in Figure 19-11). Even when mounting the volume rather than creating a new drive, you can choose your format type without regard to the underlying format of the mount point. Click Next.
Figure 19-11 Set the formatting options for the new volume.
On the confirmation page, if all the options are correct, click Finish to create and format the volume. If the type you've selected requires that the disks be converted to dynamic disks, you'll see a confirmation message from Disk Management, as shown in Figure 19-12.
Figure 19-12 Before converting disks to dynamic, you must confirm the change.
Once the volume is created, it's displayed in Disk Management, as shown in Figure 19-13.
Figure 19-13 The new RAID-5 volume being created
You could use the following script to perform the same RAID-5 volume creation using DiskPart.exe:
REM Filename: RAID5Vol.txt REM REM This is a DiskPart.exe Script. Run from the command line REM or from another script, using the syntax: REM REM diskpart /s RAID5Vol.txt > logfile.log REM REM to run this script and dump the results out to a log file. REM REM This script creates a RAID5 Volume combining disks 3,4 and 5, REM and then formats it and assigns the next available drive letter to it. REM First, list out our disks. Not required for scripting, but useful REM to show the overall environment if we need to troubleshoot problems list disk REM Create the volume (No SIZE parameter, so the maximum size for the REM selected disks will be used.) create volume RAID disk=3,4,5 REM Format the new volume. Format fs=NTFS label="RAID 5 Volume" quick REM Assign without parameters will choose the next available HD letter. Assign
Real World: Mounted Volumes
Windows Server 2008 borrows a concept from the UNIX world by adding the ability to mount a volume or partition on a subfolder of an existing drive letter. A mounted volume can also have a drive letter associated with it—although it does not need to—and it can be mounted at more than one point, giving multiple entry points into the same storage.
A volume must be mounted on an empty subfolder of an existing NTFS volume or drive. FAT and FAT32 drives do not support mounted volumes. You can, however, mount a FAT or FAT32 volume at any mount point. (But really, it's time to let go of FAT as a file system for hard disks!) You can mount only a single volume at a given mount point, but you can then mount further volumes on top of an existing mounted volume, with the same rules and restrictions as any other mount. The properties of a drive do not show all the available disk space for that drive, because they do not reflect any volumes mounted on the drive.
You can use mounted volumes to provide a mix of redundant and nonredundant storage in a logical structure that meets the business needs of the enterprise while hiding the complexities of the physical structure from the users. Unfortunately, mounted volumes are not handled correctly by Network File System (NFS) shares and should be avoided in environments where Server for NFS is used.
Creating Extended Partitions and Logical Drives
If you have extended partitions on your disks for some reason, you can create logical drives on the partition using DiskPart.exe. However, you no longer have a graphical way to create an extended partition or a logical drive, nor any real need to do so. With Windows Server 2008 providing full support for GPT disks, the old limit of a maximum of four partitions on a disk is gone—GPT disks in Windows Server 2008 support 128 partitions. If you have any existing MBR disks that include an extended partition, either because you moved a disk from another computer to your Windows Server 2008 computer or because you upgraded to Windows Server 2008 from an earlier version, we suggest you remove the existing extended partition and convert the disk to GPT.
Converting a Disk to a Dynamic Disk
Unlike earlier versions of Windows Server, with Windows Server 2008 you generally have no need to directly convert a disk to a dynamic disk. Operations that require conversion to a dynamic disk will perform the conversion as part of the operation. And deleting a volume that required dynamic disks causes the disks to convert back to basic disks in most cases. There are a few cases where the automatic conversion doesn't happen if you're using DiskPart.exe to manipulate the disk, but all the operations you perform in Disk Management do automatic conversions. For those few situations in DiskPart where explicit conversion is necessary, use the following commands:
DISKPART> select disk <n> DISKPART> convert BASIC
Where <n> is the disk number you want to convert, and where BASIC can be replaced by DYNAMIC depending on which conversion you need to do.
Conversions can only occur when there are no structures on the disk that are not supported in the target disk type.
Converting a Disk to a GPT Disk
One of the important new features of Windows Server 2008 disk management is full support for GPT disks. GPT disk support was initially only available in 64-bit Itanium versions of Windows Server, but with the release of Windows Server 2003 Service Pack 1 and the initial version of x64 Windows Server 2003, GPT support was added for all versions of Windows Server 2003. In Windows Server 2008, this support is fully integrated.
You can convert a disk between MBR and GPT as long as the disk is completely empty. Unfortunately, once you've created any partitions or volumes on the disk, you can no longer convert between the two types.
To convert a disk to GPT, follow these steps:
In Disk Management, delete any existing volumes or partitions.
Note Deleting a volume or partition will delete any data on the volume or partition. It will not destroy the data, however, so that it might be possible to recover the data.
Right-click the empty disk and select Convert To GPT Disk, as shown in Figure 19-14.
Figure 19-14 Converting from an MBR disk to a GPT disk
To do the same operation from DiskPart, type the following command:
DISKPART> select disk <n> DISKPART> convert GPT
Where <n> is the disk to be converted. That's all there is to it.
Changing the Size of a Volume
Windows Server 2008 allows you to change the size of an existing volume without losing data. You can extend the volume, either by using additional free space on the existing disk, or by spanning onto another disk that has free space. This capability is essentially unchanged from earlier versions of Windows Server. New to Windows Server 2008, however, is the ability to shrink a volume without having to use a third-party product or lose data.
When you extend or shrink a volume, only a simple volume or a spanned volume can be modified: You cannot extend or shrink striped, mirrored, or RAID-5 volumes without deleting the volume and recreating it.
Important Once you extend a volume across multiple disks, you normally cannot shrink it back down onto a single disk without deleting the volume entirely and recreating it. This means you will lose data, so consider carefully before you decide to extend a volume across multiple disks.
Extending a Volume
You can add space to a volume without having to back up, reboot, and restore your files if the volume is a simple volume or a spanned volume. To extend a volume, follow these steps:
In Disk Management, right-click the volume you want to extend. Choose Extend Volume from the menu to open the Extend Volume Wizard. Click Next.
Highlight one or more disks from the list of disks that are available and have unallocated space, as shown in Figure 19-15. Click Add to add the selected disk or disks, and indicate the amount of space you want to add. Click Next.
Figure 19-5 Selecting the disks to use to extend the volume
The Extend Volume Wizard displays a final confirmation page before extending the volume. Click Finish to extend the volume, or click Cancel if you change your mind. If you need to convert any of the disks to dynamic before extending, you'll get another confirmation prompt.
To perform the same steps from the DiskPart command line, use the commands shown in Figure 19-16.
Figure 19-6 Extending a disk using the DiskPart command-line tool
As you can see from the figure, using the command line to extend a volume is quite a few more steps than using Disk Management. Given that we hardly ever extend a volume (see the Real World sidebar), it's probably just as well to use Disk Management for this particular task. We're firm believers in using the command line whenever possible, but sometimes it just doesn't make sense.
Note A spanned (extended) volume is actually less reliable than a simple disk. Unlike a mirror or RAID-5 volume, which both have built-in redundancy, a spanned or striped volume will be broken and all data lost if any disk in the volume fails.
Real World: Extending—Administrator's Friend or Foe?
Most administrators have wished at some point that they could simply increase the users' home directory space on the fly. Without having to bring the system offline for several hours while the entire volume is backed up and reformatted to add the additional hard disks, the backup is restored, and the share points are re-created. Fun? Hardly. Risky? Certainly. And definitely a job that means coming in on the weekend or staying late at night—in other words, something to be avoided if at all possible.
All this makes Windows Server 2008's ability to create additional space on a volume without the need to back up the volume, reformat the disks, and re-create the volume a seductive feature. However, if you're using conventional hard disks without hardware RAID, you might want to think twice before jumping in. Only spanned or striped volumes allow you to add additional storage on the fly, and, because neither is redundant, using them exposes your users to the risks of a failed drive. Yes, you have a backup, but even under the best of circumstances, you'll lose some data if you need to restore a backup. Further, using spanned volumes actually increases your risk of a hard-disk failure. If any disk used as part of the spanned volume fails, the entire volume is toast and will need to be restored from backup.
Why, then, would anyone use spanning? Because they have hardware RAID to provide the redundancy. This combination offers the best of both worlds—redundancy provided by the hardware RAID controller and flexibility to expand volumes as needed, using Disk Management. Yet another compelling argument for hardware RAID, in case you needed any more.
Shrinking a Volume
While most of the time we're concerned with increasing the size of a volume on the server, there can be occasions when it might be convenient to shrink a volume. For example, if you are using a single large RAID array for multiple volumes, and one of the volumes has empty space while another volume on the same array is running out of space, it would be handy to be able to shrink the volume that has extra space and then extend the one that is running out of room. In the past, the only way you could do this was to back up the volume you wanted to shrink, delete it, extend the volume that needed growing, recreate the volume you deleted, and restore the backup. Possible, certainly. But both risky and highly disruptive to your users. The other alternative was to use a third-party product, such as Acronis Disk Director Server (http://www.acronis.com/enterprise/products/diskdirector/).
Now, in Windows Server 2008, you can use Disk Management to shrink a volume without having to delete it and recreate it. While not quite as flexible as products like Acronis Disk Director, this new capability is all that most system administrators will need. To shrink a volume, follow these steps:
In Disk Management, right-click the volume you want to shrink. Choose Shrink Volume from the menu to open the Shrink dialog box shown in Figure 19-17.
Figure 19-17 Shrinking a volume
Select the amount of space to shrink the volume by, and click Shrink.
>From the command line, the syntax of the DiskPart command is:
SHRINK [DESIRED=<N>] [MINIMUM=<N>] [NOWAIT] [NOERR] SHRINK QUERYMAX [NOERR]
where SHRINK by itself will shrink the selected volume the maximum amount possible.
Note Shrinking a volume is one place where DiskPart is well behaved. If you select a partition on a basic disk and attempt to shrink it, DiskPart doesn't require you to first convert the disk to dynamic before you can shrink the volume.
Adding a Mirror to a Volume
When your data is mission critical and you want to make sure that no matter what happens to one of your hard disks the data is protected and always available, consider mirroring the data onto a second drive. Windows Server 2008 can mirror a dynamic disk onto a second dynamic disk so that the failure of either disk does not result in loss of data. To mirror a volume, you can either select a mirrored volume when you create the volume (as described in the "Creating a Volume or Partition" section earlier in this chapter) or add a mirror to an existing volume. To add a mirror to an existing volume, follow these steps:
In the Disk Management console, right-click the volume you want to mirror. If a potential mirror is available, the shortcut menu lists the Add Mirror command, as shown in Figure 19-18.
Figure 19-18 The action menu for Disk 2 includes the Add Mirror command
Choose Add Mirror to display the Add Mirror dialog box (shown in Figure 19-19), where you can select the disk to be used for the mirror.
Figure 19-19 The Add Mirror dialog box
Highlight the disk that will be the mirror and click Add Mirror. You'll be prompted that this action will convert the disks to dynamic. Click Yes. The mirror is created immediately and starts duplicating the data from the original disk to the second half of the mirror, as shown in Figure 19-20. This process is called regeneration or resynching. (The process of regeneration is also used to distribute data across the disks when a RAID-5 volume is created.)
Figure 19-20 A newly created mirrored disk in the process of regeneration
Mirroring can also be done from the DiskPart command line. First select the disk and then use the ADD command, which has the following syntax:
ADD DISK=<N> [ALIGN=<N>] [WAIT] [NOERR]
where DISK is the disk that will be added to make the mirror, and ALIGN is used to align with a specific hardware RAID Logical Unit Number (LUN) alignment boundary.
Best Practices Regeneration is both CPU-intensive and disk-intensive. When possible, create mirrors during slack times or during normally scheduled downtime. Balance this goal, however, with the equally important goal of providing redundancy and failure protection as expeditiously as possible.
Best Practices To improve your overall data security and reliability, mirror your volumes onto disks that use separate controllers whenever possible. This process is known as duplexing, and it eliminates the disk controller as a single point of failure for the mirror while actually speeding up both reading and writing to the mirror, because the controller and bus are no longer potential bottlenecks.
Drive Failure in a Mirrored Volume
If one of the disks in a mirrored volume fails, you continue to have full access to all your data without loss. If a disk in the mirror set fails, the failed disk is marked missing and offline, and the mirror is unavailable, as shown in Figure 19-21. An alert is sent to the alert log.
Figure 19-21 Failed disk in mirror shown as missing and offline
Once the mirror is unavailable, you need to remove, or "break," the mirror, bringing the good disk back online and available. Once the problem disk has been replaced, you can rebuild the mirror by following the steps in the section "Adding a Mirror to a Volume" earlier in the chapter.
To remove the mirror, follow these steps:
In Disk Management, right-click either disk and select Remove Mirror from the action menu, as shown in Figure 19-22.
Figure 19-22 Breaking the mirror of a failed mirror pair
In the Remove Mirror dialog box, select the failed disk and click Remove Mirror.
After you replace the failed disk or correct the problem and reactivate the failed disk, the mirror automatically starts regenerating if you didn't have to remove the mirror. If you can solve the problem without powering down the system, you can regenerate the mirror on the fly. To reactivate the failed disk, follow these steps:
- Right-click the icon for the failed disk on the left side of the Disk Management console.
- Choose Reactivate Disk. Windows Server 2008 warns you about running chkdsk on any affected volumes, brings the disk back online, and starts regenerating the failed mirror.
Real World: Removing a Mirror
We all know that every system administrator is always fully aware of the ongoing requirements of her servers, and never runs out of disk space without plenty of warning. Oh, wait, this is a Real World sidebar. OK, reality check, then. If you have the luxury of huge budgets and large, flexible, highly redundant Storage Area Networks, you probably haven't been caught short on disk space. But if you're running a more ordinary network where budgets interfere and resources are constrained, we strongly suspect you've certainly had times when you were scrambling to clean up disks to make sure you didn't run out of room for a critical process. Certainly we have. If you have a mirrored volume, you can get yourself out of trouble pretty quickly. But at a significant risk in the long run.
Just remove the mirror from the mirrored volume. When you remove a mirror, the data on one of the disks is untouched, but the other disk becomes unallocated space. You can then use the unallocated space to extend the volume that is short.
Of course, you will have lost all redundancy and protection for the data, so you need to take steps to restore the mirror as soon as possible. Plus the volume you've extended is now more susceptible to failure, since it has an extra disk included in it. Until you can buy more disks, you'll want modify your backup schedule for the affected disks. And don't put off buying the new disks—you're at serious risk until you get your system back to where it should be.
© Microsoft. All Rights Reserved.