Getting NTFS cluster size using Powershell

Hi folks,

These days I was working on an IO issue and I as every IO performance issue – I started with checking the basics. One of these is to verify that the NTFS cluster size of the partitions, holding the SQL Server data and log files are formatted with 64 KB (default for Windows is 4K so it is a step everyone should take prior deploy the SQL Server in production).

So far the way to check that (or the way I used to do it) was using chkdisk command. This is very tedious job, though. If you need to do it for 20 disks for example…So I needed something better. Checked google and found this very neat blog post, describing exactly what I was needed:

foreach ($drive in Get-PSDrive | where {$_.Provider.name -eq "FileSystem"}) {
      if ($drive.free -ne $null) {
            "$drive - $((get-ntfsinfo $drive.name).bytes_per_cluster)"
      }
}

The output is great, so if you need to do this – you can count on Powershell to help.

Leave a Reply

Post Navigation