When you first get a new hard drive, one of the things you may have to do is format it. This applies a basic structure to the drive that the operating system can use to store data. Some file systems are supported between operating systems and are thus ideal for use in removable drives intended to be used cross-platform. Some are platform-specific, including the default file system format for both Windows and Mac OS.
When you’re formatting your drive, one of the questions you’ll be asked is the allocation unit size you’ll want to use. At least in Windows, the default value is 4KB for most drives. But you can manually change that, higher and lower, if you prefer. The real question is, should you?
What Is An Allocation Unit?
Storage drives are split into much smaller sections to make them more manageable. Each of these sections is one allocation unit in size. The allocation unit is the unit of file size on the drive. No matter what size, every file will take up a perfect multiple of the allocation unit.
With the default 4KB allocation unit, all files will take up a multiple of 4KB on the drive. Any space to the next multiple of 4KB file size is essentially wasted and unusable. So why not set the allocation unit to be as small as possible? The main issue is that this increases the complexity of the file storage system; there are many more allocation units for the drive to keep track of. Additionally, smaller allocation units increase the chance of fragmentation if you’re using an HDD. This will negatively impact HDD performance, which is significantly affected by non-sequential operations. This specific effect will be much lower on SSDs that don’t suffer a performance loss from fragmentation.
Optimizations
Having a large allocation unit size means that more space is lost for every file you have on the drive. This means that the effect of large allocation units should be less of an issue on massive drives. It also means that it should be less of a problem if you’re primarily or exclusively storing large files.
For example, if you use an allocation unit size of 2MB, you lose, on average, 1MB per file. If you only store large video files on the hard drive, you’re unlikely to have many instances of lost megabytes. Conversely, if you use the drive primarily for vast numbers of smaller files, then you lose many more megabytes of unused space. If you’ve got a tremendous amount of storage space, closing space isn’t much of an issue. If, however, you have a tiny storage drive, such as an early USB stick, you might have so little space that losing even an average of 2KB per file is an issue.
Interestingly, Windows allows for the drive size when suggesting the default allocation unit. Microsoft documents the actual figures here. In the default NTFS file format, the default allocation unit size is 4KB for any drive up to 16TB. As 16TB drives are rare and excessively expensive, most people will only ever have seen this default value. The default allocation unit changes to 8, 16, 32, then 64KB at 16, 32, 64, and 128TB drive capacities.
Only you can say what type of files you’ll store on your drive. You’ll likely have a mix of large and small files if it’s a general-purpose drive. An allocation unit size of 4KB is generally considered optimal for most drives.
Conclusion
An allocation unit is a part of the file format system in which a storage drive is formatted. In Windows’s default file format system, all drives below 16TB have a default allocation unit size of 4KB. The allocation unit is the unit of storage a file can take up on the drive. This means that if you end up with a file one byte short of 4KB, it takes up 4KB on the drive. If you end up with a drive of 1 byte over 4KB, that file will take up two allocation units, consuming 8KB of drive space.
On average, half of the allocation unit is empty for every file on the drive. Decreasing the allocation unit size increases the complexity of managing the file system as it results in more units. Doing can also impact HDD’s performance because it can result in increased fragmentation. The size can improve performance slightly but also result in more space being lost per file. Generally, an allocation unit of 4KB is considered minimal, with that only really changing in drives exceeding 16TB.