SQL Server / 64KB Allocation Unit Size

MS SQL Server Best Practices Article suggests as a SQL Server configuration best practice is to format your data, logs, and tempdb file drives with a 64KB allocation unit size.

NTFS Allocation Unit Size
When formatting the partition that will be used for SQL Server data files, it is recommended that you use a 64-KB allocation unit size for data, logs, and tempdb. Be aware however, that using allocation unit sizes greater than 4 KB results in the inability to use NTFS compression on the volume. SQL Server, although it is not recommended that you use this, does support read-only data on compressed volumes.
Source
https://technet.microsoft.com/en-us/library/cc966412.aspx

What does that mean?

That practically means that no matter how small file you have on the drive formatted with allocation unit size to 64KB that file will take up whole 64KB on disk.

Example

C drive is formatted with 4 KB allocation unit size (4KB is default cluster size and it recommended for operating system and file share drives.)

 

And we have a file called 1.txt with size of 1.17KB

 

You can see that size on disk will be equal to the allocation unit size, no matter if file it is actually smaller than that.

Lets copy the same file to the D drive which has allocation unit size 64KB

 

File properties window now look like this

 

Size on disk for the same file will be now equal to 64KB which is the allocation unit size for that drive.

64KB allocation unit size for a drive does not look as best idea if you have lots of really small files but our SQL Server data and log files are much bigger than that.

There are really good whitepapers with a recommendation to keep allocation unit size for SQL Server data and log drives at 64KB. 64KB presents one full extent or 8 * 8KB pages in SQL Server.

 

To determine file allocation unit size for your drive you can run following command and for all drives

fsutil fsinfo ntfsinfo c:
fsutil fsinfo ntfsinfo d:

On Windows 2008 and newer versions you can use GUI to format drive (64K allocation unit) and for previous version OS you can use DISKPART to perform partition alignment and assign file allocation unit size.

 

 

 

Similar Posts:

12 Responses to “ “SQL Server / 64KB Allocation Unit Size”

  1. Elmo Neigh says:

    Really Appreciate this post, is there any way I can get an email sent to me every time you make a fresh update?

  2. antonio says:

    a shorter command to get name, label and blocksie for all volumes is from
    cmd> wmic volume get name, label, blocksize

    • Barac says:

      I agree Antonio, it can be used for obtaining partition starting offsets of Windows basic disks as well
      wmic partition get BlockSize, StartingOffset, Name, Index

  3. antonio says:

    a shorter command to get volume details: from cmd
    wmic volume get name, label, blocksize
    output:
    BlockSize Label Name
    4096 C:\
    4096 Temporary Storage D:\
    4096 tempdb E:\
    65536 DATI F:\

  4. Kristian Aasen says:

    Hi Zoran
    FOr Windows Server 2019 there is an option to go further and do 2M AU.
    Any thoughts?

  5. Minor Revisions
    =============

    Original
    ——–

    You can see that size on disk will be equal to the allocation unit size, no matter if file it is actually smaller that that.

    Revise
    ——

    You can see that size on disk will be equal to the allocation unit size, no matter if file it is actually smaller that ( than ) that.

    ===============================================

    Original
    ——–

    To determent file allocation unit size for your drive you can run following command and for all drives

    Revise
    ——

    To determent ( determine ) file allocation unit size for your drive you can run following command and for all drives

    ===============================================

  6. Krishna says:

    Is it recommended for Binary files and system databases drive as well to have 64k format?

    • Barac says:

      Hi Krishna,
      Sys DBs are usually small so there is no real benefit from the 64 KB AU.
      SQL binaries should be on the default 4KB.
      Cheers

Leave a Reply to Barac Cancel reply

Your email address will not be published. Required fields are marked *