Disk Management
Disk Management
1. List disks
Before you can begin configuring and managing your Windows Server storage, you first need to fetch
the list of disks presented on the machine using PowerShell.
Activity 1:
2. Format a disk (Warning: Do not execute the foregoing commands in you unit, it will erase your entire
data and can not be recovered anymore)
Having new disks present on the server is a totally different case, but there may be scenarios where
you want to format existing disks and then create partitions and volumes. You can use the Clear-Disk
cmdlet to remove all partition information and uninitialize it, which will erase the data on the disk.
This is an unrecoverable process, so please make sure to back up your disk before running the
command.
3. Initialize a disk
A new disk or a cleaned disk using the cmdlet mentioned above is in an uninitialized state, and you
have to initialize it first using the disk number of the target disk.
Initialize-Disk -Number 2
By default, this initializes all disks as GUID Partition Tables (GPTs) unless explicitly specified, and you
can use the -PartitionStyle parameter to initialize a disk as a Master Boot Record (MBR).
Initialize-Disk 4 –PartitionStyle MBR
If the disk has recently just become present on the server, it will be in a raw partition style state. You
can easily target and initialize such disks using the following command:
After partitioning the disks, you can list them to see the current status:
After creating the partitions, they are still not accessible from the File Explorer. You have to create
new volumes in a format (like NTFS) that the operating system understands.
# Delete a partition
Get-Partition –DiskNumber 2,3 | Remove-Partition -Confirm:$false