Tune2fs – how much space to reserve on large ext4 filesystem

disk-usageext4filesystemsroot

I am aware that there are several questions concerning how much space to reserve on a filesystem using tune2fs -m, but some of the advice is contradictory, some seems to be relevant only to the filesystem where root is mounted, and none seems to be specifically for ext4.

The drive I'm enquiring about is a 3 TB hybrid SSD/Hard Disk with one partition formatted using ext4 and which is ONLY used for media files. Root, home, and swap are all in their own partitions on a SSD drive which I will be leaving well alone.

At the moment on the 3 TB ext4 filesystem, 5% of disk space is reserved (the default), but that's a whopping 150 GB. If safe to do so I'd like to reduce this to 1%, which would be 30 GB, and in so doing free up 120 GB. Please note that the filesystem is 92% full, 5% of the remaining is the reserved space.

The advice in this answer, suggests that setting the reserved space to 5% is sensible on nearly full ext3 filesystems to avoid fragmentation. It then states that ext4 is more efficient, explicitly stating that: "ext4's multi-block allocator is much more fragmentation resistant". It does NOT then go on to advise what percentage would be sensible for ext4.

I'd like to know whether it would be safe to reduce the reserved drive space to 1% on my 3 TB ext4 filesystem, while still maintaining adequate filesystem fragmentation protection?

If the 30 GB reserved space at 1% is not enough, then how little would be safe?

Thanks.

Best Answer

This reserve is primarily for the core system partitions so that root can still log in if a regular user manages to fill the drive and clog up the works. The space is needed for temp files, copying, and general elbow room for shell commands.

None is strictly needed on simple user data volumes. 5% on large modern drives is way too much, I use 2% just to be safe but likely is still overkill.(100 MiB would likely be enough for emergency mode on many systems)

However, the secondary reason for reserved space is that it leaves gaps between the end of one file and the beginning of the next. A little space can help prevent fragmenting of frequently altered files, essentially the modifications can be kept within the same physical area as the original file. Media files are rarely modified, unless of course you are editing said media. On SSDs fragmenting doesn't matter, as all segments are accessed at equal speed.

Related Question