Get the allocation unit size of an NTFS partition in Server 2012

If you’re a SQL Server Pro you will know that the volumes the SQL log and datafiles are stored on should be formatted with a 64K cluster size. This is a SQL Server Best practice as stated in this link.

I found this handy piece of PowerShell code that gets just the allocation unit size for all disks in the system:

$sql = "SELECT Label, Blocksize, Name FROM Win32_Volume WHERE FileSystem='NTFS'"  
Get-WmiObject -Query $sql -ComputerName '.' | Select-Object Label, Blocksize, Name 

The result of which would look similar to this on a system running SQL Server:

The results above show which disks are configured with the default 4K allocation unit size and those configured with 64K which are the SQL disks.

Nav Malik

Add comment