Thursday 17 June 2021

Find Allocation Unit Size of Disk Using Powershell

Everything in SQL Server is stored on disk in 8K pages.  The Microsoft recommended best practice is to format using a 64K allocation unit size.  Processes such as the checkpoint and Lazy Writer try to write in extents when possible.  Extents are a collection of 8 pages and since each page is 8K we get 64K.  That is where the best practice recommendation originated.

You can check what Allocation Unit Size was used when the disks were originally formatted by using the following Powershell Command (Be sure to run Powershell with Administrative privileges)

PS C:\Windows\system32> Get-Volume | Format-List AllocationUnitSize, FileSystemLabel