- Storage Spaces Direct
- Windows Volume Mgmt.
- Windows File Systems
- Volume Shadowcopy Services
- Storage Replica
A basic disk is a physical disk accessable from your PC, Laptop or Server. Typically, a PC or Laptop will have one physical disk, called the C: However this physical disk will be split into several partitions. A disk can contain primary partitions, extended partitions, or logical drives. Windows Servers tend to use more sophisticated methods for storing application data away from the system and boot volume. You can read about one method, Windows Storage Spaces Direct, here.
If you create your basic volumes as NTFS, then you can add more space to existing primary partitions and logical drives by extending them into adjacent, contiguous unallocated space on the same disk.
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.
A lot of 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.
Disk management is basically about taking one or more physical disks and formatting them into volumes, drives and partitions. You can do this in Windows Server 2016 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.
As well as formatting volumes, you can use Disk Management to add extra capacity to a volume of free space is available, to shrink a partition to free up space, and to change a drive letter or assign a new drive letter.
The Windows system volume, usually the C:\, usually has three partitions; an EFI system partition, the Windows partition, and a recovery partition.
If you look through Disk Management, it might appear that the EFI system partition and the recovery partition are both empty, but this is incorrect. These partitions are usually quite full and are critical, so don't try to shrink them.
This page will concentrate on using the diskpart.exe command line. Some people prefer to use GUIs to manage their disks and that is probably best for a PC. However if you are making changes to a number of servers, 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.
It's good practice to always back up the hard disk before running DiskPart.
To access DiskPart, simply type diskpart from a command window
Diskpart.exe works by putting an object into focus, then performing actions on that object. When you select an object, the focus remains on that object until you select a different object. Some commands, like 'create new partition' will automatically change the focus. However, the 'list partition' command only displays partitions on the disk that has focus. When you use the 'list' commands, an asterisk (*) appears next to the object with focus. You can find out what objects exist by using the list commands. You need to be logged on as an Administrator, or be in the local Administrators group to run DiskPart.
LIST VDSK (Windows 2008 only)
Once you know what objects exist, you put one into focus by selecting it
SELECT Volume=n-or-d (Number or Drive Letter)
When you are working with disks and using the select command to target disks on your system, it is important to note how the drives are numbered. Drives are numbered beginning with 0. That means the first drive in your system is drive 0. So, if you wanted to use the select command to select the first disk, the command would look as follows:
select disk 0
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
diskpart /s change20170825.txt > change20170825-log.txt
Some sample diskpart scripts include
set the focus to disk 0, create a primary partition on it, assign it as drive f: and format it as NTFS
Create partition primary
format FS=NTFS label="VOL00F" quick
The volume type can be simple, striped or raid. Striped and raid volumes need to span several disks, hence the disks parameter has several device numbers, separated by commas.
CREATE VOLUME Simple Size=n Disk=n
CREATE VOLUME Stripe Size=n Disk=n,n,...
CREATE VOLUME Raid Size=n Disk=n,n,...
List out the volumes to get the volume numbers, set the volume that we want to extend, then run the extend command. In this case we are extending the volume by 250GB
select volume n
List out the volumes to get the volume numbers, set the volume that we want to shrink, then run the shrink command. Desired is the ideal new volume size, minimum is the lowest possible size the volume can shrink to.
select volume n
shrink desired=100000 minimum=75000
Convert disk 3 to dynamic, format the disk as NTFS, create a new 500G volume, assign a drive letter of F, and add a label of 'Work Drive' - notice how the select statements change the focus from disk 3 to volume f.
select disk 3
create volume simple size=500000 disk=3
assign letter f
select volume f
format FS=NTFS label="work Drive" quick
Convert disk 2 and disk 3 to dynamic, create a mirrored volume of 200GB, assign a drive letter of M, format the new mirrored volume with NTFS, and add a label of 'Mirrored user drive'
select disk 2
select disk 3
create volume mirror size=200000 disk=2,3
assign letter m
select volume m
format FS=NTFS label="Mirrored user drive" quick
**Alert** CLEAN will delete all the data off your disk, including partitions and formatting. Use it with care.
select disk number (Pick the number of the disk you want wiped)
detail disk (This will display a list of partitions that exist on this hard disk)
** Check the partition information and make sure that the disk does not contain any required data **
clean all (The clean command will only apply to the disk that you put into focus above)
All the partitions and all the data on the disk is now permanently removed.
**Alert** This command will delete all the data in the selected partition. Make sure you really want to do it.
You can use the diskpart delete command to delete dynamic disks, partitions or volumes. The example below illustrates how to delete a paertition.
select disk number (Pick the number of the disk where you want to delete the partition. This disk now becomes the focus)
select partition number (The selected partition now becomes the focus)
delete partition number (The focus now switches back to the disk)
list partition (... and that partition should be gone)
The repair command just applies to the Windows Server releases and it is used to repair a faulty section on a RAID-5 volume. First you put the faulty disk into focus, then you run the repair command, stating which dynamic disk to use to replace the faulty section. The dynamic disk has to be at least as big as the faulty RAID disk region.
select disk number (This is the faulty disk, the one you want to repair)
repair disk=3 (You will replace the faulty RAID region with disk 3 )