Disk management is basically about taking a set of physical disks and formatting them into volumes, drives and partitions. You can do this in Windows Server 2008 with the Disk Management GUI, or the DiskPart.exe command line. You find the Disk Management GUI in Server Manager – Storage or by running Diskmgmt.msc from a command line. The GUI lets you remotely manage older Windows servers and PCs from the Windows 2000 operating system upwards.
However this page will concentrate on using the diskpart.exe command line. Some people prefer to use GUIs to manage their disks, but if you are making a number of changes it is much easier to set the commands up into a script file then run it through a command line. It is also much easier to check the commands this way, before you run them. Fsutil.exe and Mountvol.exe are also command line utilities..
First, some words about windows disk storage in general.
Dynamic disks were developed in conjunction with Veritas software and introduced in Windows 2000 Server. At that time, physical disks were limited in size and were prone to failure. Dynamic disks let you combine several physical disks into one dynamic volume, and form volumes into RAID 0,1 or 5 configurations, stripe the data, mirror the data and dynamically resize volumes, usually without needing a system reboot.
However now almost all server disk is supplied behind a RAID controller and you can get this dynamic disk functionality in that controller. The virtualised, striped and RAIDed disk is presented to the Windows system by the RAID controller as a basic disk and then it is much easier to manage at Windows level, especially in a DR situation. The general feeling seems to be that it is best to do virtualisation out in the hardware, and not at Windows.
Using DISKPART
It's good practive to always back up the hard disk before running DiskPart.
Diskpart.exe works by putting an object into focus, then performing actions on that object. You can find out what objects exist by using the list commands .
LIST Disk
LIST Partition
LIST Volume
LIST VDSK (Windows 2008 only)
Once you know what objects exist, you put one into focus by selecting it
SELECT Disk=n
SELECT Partition=n
SELECT Volume=n_or_d (Number or Drive Letter)
Put your commands into a text file with one command per line then run DiskPart with the text file as input. The naming standard below makes it easy to find out what changes were made, and the output is written to a log file. From the command line, execute your script like this
If your script has an error, then DiskPart will stop running and return an error code. You can force the script to ignore errors and run to completion by adding the noerr option like this; online disk noerr. The DiskPart error codes are
0 - Your script worked without any errors!
1 - You have had serious problem.
2 - You supplied incorrect parameters.
3 - You got your script name or output file name wrong.
4 - There was an error in the DiskPart services.
5 - You got your command syntax wrong. Possibly you could not select the object you asked for, or maybe the command you tried does not work with that object.
Adding a New Disk
Adding a new disk to a Windows Server 2008 server is straightforward. Once you need physically install and connect the drive, you may need to shut down and power off the system to pick it up, unless you have a hot-swappable backplane and array. If you're adding a drive to your server that uses a different technology than existing drives, or simply a different controller, you might need to install a new driver.
After you install the drive and power up the system again, Windows Server 2008 automatically recognizes the new hardware and make it available. What happens next depends on the type of disk
Brand new unformatted disk – needs to be initialised, in this case as mbr.
select disk n
attributes disk clear readonly
online disk
convert mbr
Basic disk that is already partitioned and formatted – will appear to be offline
select disk n
online
Dynamic disk that has been used on a different machine - needs to be imported.