Become a member

Get the best offers and updates relating to Liberty Case News.

― Advertisement ―

HomeUncategorizedWhat Should I Set the Allocation Unit Size to When Formatting?

What Should I Set the Allocation Unit Size to When Formatting?

Jason Fitzpatrick

A mechanical hard drive.
Hannah Stryker / How-To Geek

You should use the default allocation unit size that is recommended when you format the drive. For NTFS drives, which are common on Windows, that will probably be 4096 bytes. If you’re only going to be storing large files on a drive, feel free to use a larger allocation unit size — it’ll improve your storage efficiency.

When you format a new storage device, be it an internal solid-state drive or an external flash drive, you can pick the file system you want to use and the allocation unit size. But what is the allocation file unit size, and what does it do? Here’s everything you need to know.

What Is Allocation Unit Size?

Allocation Unit Size — otherwise known as “Cluster Size” or “Block Size” — refers to the size of the chunks that a solid state drive (SSD) or hard disk drive (HDD) is divided into. When you increase the size of the allocation unit, the “chunk,” you decrease the total number of allocation units on your drive. If you decrease the size of the allocation unit, the opposite happens — you increase the number of allocation units on the drive.

Note: The term “Allocation Unit,” “Block, ” and “Cluster” all refer to the same thing in this context, and we’ll use them interchangeably in this article. The term block is typically seen when talking about Linux, especially the ext4 file system, whereas cluster and allocation units are seen with Windows.

If a file is too big to fit in a single block, then it will be split and span multiple blocks. If a file is smaller than the block size, then it will be stored in that block, but the entire block volume will be used up. This can result in inefficient storage in some extreme cases, but we’ll go into that in more detail later.

Here’s a brief example of how allocation units, the size of allocation units, and the volume of your storage drive are related. To make the math easy, we’re going to talk about a tiny hypothetical hard drive with a total volume of 16,384 kilobytes (16 MB) — absurdly small by 21st-century standards, but convenient to illustrate the point.

So, you plug in your 16,384 kilobyte drive and choose to partition it as an NTFS file system. The default allocation unit size for an NTFS drive of that size is 4069 bytes, or 4 KB. Your drive will have 16,384/4 (4,096) units — or blocks— on it. If you increased your allocation unit size to 32 kilobytes, you’d instead have 16,384/32 (512) clusters. This holds for any HDD or SSD of any size, though the larger drives we’re used to today will have many millions of blocks rather than a few thousand.

What Allocation Unit Size Should You Use?

You should stick with the default allocation unit size that is suggested when you format your storage device unless you have an extremely specific reason to change it. For the average NTFS drive, that will be 4,096 bytes, or 4 KB.

Select the allocation unit size you want.

The default size does change depending on the size of the partition and the file system you’re using. Generally speaking, as the partition gets larger, so does the allocation unit size. We’ve put together some tables comparing NTFS, FAT32, and exFAT, since they’re the most common formats you’ll encounter, and are regularly used with USB flash drives, storage drives, and SD cards.


Why Change the Allocation Unit Size?

At least in theory, changing the allocation unit size can optimize drive speed or storage space. In practice, you probably won’t notice this or care very much if you stick with the default value, since modern drives are both large and extremely fast. There are really only two extreme cases where you might have to worry about this:

  1. When you have a few enormous files, and you choose a tiny allocation unit size
  2. The opposite scenario, where you have a ton of tiny files, and you choose a large allocation unit size.

If you have only a few enormous files and you use the 4096 byte option, you’ll wind up creating a ton of clusters (volume size in bytes/4096 bytes) that are filled with only a few files. Each allocation unit winds up holding only a fraction of the total file. For example, if you have a 4096-byte allocation unit size and you have a 12 KB file, you’d need to use three allocation units (or blocks) to store the complete file. The more blocks you use to store a file, the greater the possibility for fragmentation, and the more blocks your operating system needs to keep track of. This can slow down your drive’s performance.

Note: Fragmentation isn’t the problem it once was. Windows defrags itself regularly, and you’ll probably never notice it happening.

In the opposite situation — many small files with a large allocation size — you wind up wasting storage space. Each allocation unit can only hold one file at the most. If you have an allocation unit size of 64 kilobytes and you write a 3-kilobyte file to it, that entire block will be filled. That means you’ve used up 64 kilobytes of storage to store only 3 kilobytes. If you had enough 3 KB files to fill an entire drive formatted that way, you’d wind up wasting more than 95% of the drive’s total volume. If you shrink your allocation unit size to 4KB, you’d only waste 25% of the drive’s total volume. That is an extreme example, however, and you won’t typically see losses like that with average use.

The average amount of wasted space is half of the allocation unit (block) size per file on the volume. So, if you choose a 4096 byte block size, and you’ve got 100,000 files, you’ll waste only about 200 megabytes (4KB/2*100,000) of storage space. On the other hand, if you pick a 64 KB block size with 100,000 files, you’ll waste an average of 3.2 gigabytes. It’s not really something to lose sleep over considering the sizes of modern SSDs and HDDs.

If you know in advance that you’re exclusively going to be storing larger files on a drive, like if you’re hosting your own Jellyfin Media Server, then it definitely won’t hurt to use a larger allocation unit size. Otherwise, you should stick to the default value.

Source link