How to Configure Windows Server 2019 Disk Management
Disk management on Windows Server 2019 encompasses initializing new disks, creating partitions and volumes, converting between MBR and GPT partition styles, resizing volumes, assigning drive letters, and managing virtual hard disks. The Disk Management MMC snap-in provides a GUI, while diskpart and PowerShell’s storage cmdlets provide scriptable, automatable alternatives suitable for large-scale deployments. This guide covers all essential disk management operations on Windows Server 2019.
Initializing New Disks
When adding a new disk to a Windows Server 2019 system (physical or virtual), it must be initialized before it can be used. Using PowerShell:
# List all disks and their status
Get-Disk | Select-Object Number, FriendlyName, PartitionStyle, OperationalStatus, Size, BusType
# Initialize a new disk (disk number 1) as GPT (preferred for disks >2TB)
Initialize-Disk -Number 1 -PartitionStyle GPT -PassThru
# Initialize as MBR (legacy, for disks <2TB or older BIOS systems)
Initialize-Disk -Number 1 -PartitionStyle MBR -PassThru
# If already initialized, check partition style
Get-Disk -Number 1 | Select-Object PartitionStyle
Creating Partitions and Formatting Volumes
# Create a new partition using all available space and format it as NTFS
$disk = Get-Disk -Number 1
$partition = New-Partition -DiskNumber 1 -UseMaximumSize -AssignDriveLetter
Format-Volume -Partition $partition -FileSystem NTFS -NewFileSystemLabel "DataDrive" -Confirm:$false
# Create a specific-size partition (e.g., 200GB)
New-Partition -DiskNumber 1 -Size 200GB -AssignDriveLetter |
Format-Volume -FileSystem NTFS -NewFileSystemLabel "Logs" -AllocationUnitSize 65536
# Create partition with a specific drive letter
New-Partition -DiskNumber 1 -UseMaximumSize -DriveLetter D |
Format-Volume -FileSystem NTFS -NewFileSystemLabel "DataVol" -Confirm:$false
Using Diskpart for Advanced Operations
# Open diskpart and run commands
diskpart
DISKPART> list disk
DISKPART> select disk 1
DISKPART> list partition
DISKPART> select partition 1
DISKPART> detail partition
# Create a primary partition
DISKPART> create partition primary size=102400
DISKPART> format fs=ntfs label="DataDrive" quick
DISKPART> assign letter=E
# Convert disk from MBR to GPT (WARNING: data loss if partition exists)
DISKPART> select disk 1
DISKPART> clean
DISKPART> convert gpt
# Extend a volume to use available free space
DISKPART> select volume 2
DISKPART> extend
Resizing Volumes with PowerShell
# Check maximum size a partition can be extended to
$partition = Get-Partition -DriveLetter D
$maxSize = ($partition | Get-PartitionSupportedSize).SizeMax
Write-Output "Current size: $([math]::Round($partition.Size/1GB,2)) GB"
Write-Output "Max possible size: $([math]::Round($maxSize/1GB,2)) GB"
# Extend the partition to use all available space
Resize-Partition -DriveLetter D -Size $maxSize
# Shrink a partition - leave at least 50GB free on the volume
$targetSize = 150GB
Resize-Partition -DriveLetter D -Size $targetSize
Changing Drive Letters and Volume Labels
# Change drive letter assignment
# Remove existing letter E, assign F
Remove-PartitionAccessPath -DriveLetter E -AccessPath "E:"
Add-PartitionAccessPath -DiskNumber 1 -PartitionNumber 1 -AccessPath "F:"
# Set volume label
Set-Volume -DriveLetter F -NewFileSystemLabel "AppData"
# Mount a volume to a folder path instead of a drive letter
$folder = "C:MountPointsDataDrive"
New-Item -Path $folder -ItemType Directory -Force
Add-PartitionAccessPath -DiskNumber 1 -PartitionNumber 1 -AccessPath $folder
Managing Virtual Hard Disks (VHD/VHDX)
# Create a new dynamically expanding VHDX
New-VHD -Path "D:VirtualDisksDataDisk.vhdx" -SizeBytes 500GB -Dynamic
# Create a fixed-size VHDX (better performance, pre-allocated)
New-VHD -Path "D:VirtualDisksLogDisk.vhdx" -SizeBytes 100GB -Fixed
# Mount a VHDX
Mount-VHD -Path "D:VirtualDisksDataDisk.vhdx"
# Get the disk number of the mounted VHD
$mountedDisk = Get-VHD -Path "D:VirtualDisksDataDisk.vhdx"
$diskNumber = $mountedDisk.DiskNumber
Write-Output "VHD mounted as disk $diskNumber"
# Initialize and format if new
Initialize-Disk -Number $diskNumber -PartitionStyle GPT
New-Partition -DiskNumber $diskNumber -UseMaximumSize -AssignDriveLetter |
Format-Volume -FileSystem NTFS -NewFileSystemLabel "VHDData"
# Dismount when done
Dismount-VHD -Path "D:VirtualDisksDataDisk.vhdx"
Checking Disk Health with S.M.A.R.T. and Error Checking
# Check disk for file system errors (online check - no downtime)
Repair-Volume -DriveLetter C -Scan
# Full check with repair (requires volume to be offline or at next boot)
Repair-Volume -DriveLetter D -OfflineScanAndFix
# Check disk health via Storage subsystem
Get-PhysicalDisk | Select-Object DeviceId, FriendlyName, HealthStatus, OperationalStatus,
Size, BusType, MediaType, UsageSetting
# View disk reliability counters
Get-PhysicalDisk | Get-StorageReliabilityCounter |
Select-Object DeviceId, Temperature, ReadErrorsTotal, WriteErrorsTotal, Wear
Scripting Disk Setup for New Server Deployments
# Complete disk setup script for a new server
$rawDisks = Get-Disk | Where-Object { $_.PartitionStyle -eq "RAW" }
foreach ($disk in $rawDisks) {
$diskNum = $disk.Number
Write-Output "Initializing disk $diskNum ($([math]::Round($disk.Size/1GB,0)) GB)"
Initialize-Disk -Number $diskNum -PartitionStyle GPT
$partition = New-Partition -DiskNumber $diskNum -UseMaximumSize -AssignDriveLetter
$label = "DataDisk-$diskNum"
Format-Volume -Partition $partition -FileSystem NTFS -NewFileSystemLabel $label -AllocationUnitSize 65536 -Confirm:$false
Write-Output "Disk $diskNum formatted as $label on drive $($partition.DriveLetter):"
}
For production server deployments, document all disk configurations including disk numbers, partition layouts, drive letters, file system types, and allocation unit sizes. This documentation is essential for disaster recovery planning — knowing the exact disk layout allows you to recreate the configuration quickly when restoring from backup or provisioning replacement hardware.