Content:
When formatting a drive using EXT4, you’ll notice that a chunk of space is taken before you’ve even added any files. This is due to the filesystem reserving blocks, to ensure system processes can continue even when the filesystem is nearly full.
By default, EXT4 will reserve 5% of the total filesystem space. When EXT4 was introduced back in 2006, smaller drive sizes meant that 5% figure was a reasonable amount of space to reserve. However, with drives spanning terabytes, the default setting will reserve tens of gigabytes of space – not a small amount!
Fortunately, the reserved block percentage is easy to change using tunefs2
.
Setting a New Reserved Block Value
The first step to reducing the reserved block percentage is to identify the partition you are looking to change.
The easiest way to do this is to run
df -h
and note the value in the Filesystem
field for the partition you want to change.
Next, use the following command to change the reserved block percentage, replacing the filesystem path for the one identified in the previous step. This example sets the reserved percentage to 0, to regain the maximum amount of space.
tune2fs -m 0 /dev/nvme01np1
It’s possible to use a larger value if desired. A value of 0.1% might provide a good balance between preserving space, and still maintaining a small amount of reserved blocks for system use. On a 1TB drive, this would reserve around 1GB.
Is It Safe?
Way back in 2009, prominent EXT4 developer Theodore Tso answered an email, asking if it’s safe to set the value to 0%. He responded confirming that it “won’t affect performance much” aside from a few very specific circumstances. And better yet, for archival storage, media drives, devices not storing the root OS etc, it won’t matter at all.
So yes, it’s safe to set this value to 0%.
Conclusion
It’s unfortunate that the default 5% value hasn’t been updated to take into account the size of the drive. A sliding percentage, or a fixed upper limit, would make the default more palatable for the end user. After all, many users are unlikely to even realise that this has happened, and would unknowingly be wasting storage space on their device.