125

I understand that by default, newly created filesystems will be created with 5% of the space allocated for root. I also know you can change the defined space with:

tune2fs -m 1 /dev/sdXY

What I'm curious about though, is what the actual purpose for this reserved space is. Does it serve any practical purpose which would merit more than 5% space in some circumstances?

The reason I've stumbled upon this question is that we recently built a 1TB filestore, and couldn't quite figure out why a df -h left us missing 5% of our capacity.

3
  • 1
    Okay, now that's a massive waste of 'unavailable' space. Maybe the 5% should be limited to drive sizes smaller than X (e.g. 5% of disk space to a maximum of 100MB).
    – tshepang
    Feb 24, 2011 at 11:44
  • 4
    On my 8 TB filesystem 400 GB just gone away - this is the real waste of space!! :)
    – Ilia Ross
    Mar 27, 2013 at 17:38
  • With ext4, you can control the percentage at the time the filesystem is created with the -m reserved-blocks-percentage option. Mar 21, 2020 at 1:19

4 Answers 4

121

Saving space for important root processes (and possible rescue actions) is one reason.

But there's another. Ext3 is pretty good at avoiding filesystem fragmentation, but once you get above about 95% full, that behavior falls off the cliff, and suddenly filesystem performance becomes a mess. So leaving 5% reserved gives you a buffer against this.

Ext4 should be better at this, as explained by Linux filesystem developer/guru Theodore Ts'o:

If you set the reserved block count to zero, it won't affect performance much except if you run for long periods of time (with lots of file creates and deletes) while the filesystem is almost full (i.e., say above 95%), at which point you'll be subject to fragmentation problems. Ext4's multi-block allocator is much more fragmentation resistant, because it tries much harder to find contiguous blocks, so even if you don't enable the other ext4 features, you'll see better results simply mounting an ext3 filesystem using ext4 before the filesystem gets completely full.

If you are just using the filesystem for long-term archive, where files aren't changing very often (i.e., a huge mp3 or video store), it obviously won't matter.

2
  • 5
    As noted at superuser.com/a/1257550/38062 , these "90%" and "95%" figures have their origins in measurements against Berkeley FFS done in the 1980s. In the decades since, other people have challenged this oft-repeated received wisdom.
    – JdeBP
    Nov 8, 2017 at 12:43
  • 2
    There is no performance mitigation for normal users with this reserved space. They will simply get no space on device earlier than expected. The root however will have enough room to fix whatever problem was filling the disk.
    – crististm
    Jun 25, 2019 at 14:18
50

If you allow others to log on to your system, via ssh, for example, having these 5% blocks reserved ensures external users cannot fill the disk. Even if you don't allow others to log in to your system, the reserved blocks prevents programs not running as root from filling your disk.

0
33

The default of 5% is meant for system partitions. For example, if your disk space fills up, the system logs (/var/log) and root's mailbox (/var/mail/root) can still receive important information. For a /home or general data storage partition, there's no need to leave any space for root. For special needs, you can change the user that gets the emergency space (tune2fs -u 1234).

There's another reason to not allow an ext[234] filesystem to get full, which is fragmentation.

0
25

With the blocks reserved your users, and services that are running as specific users rather than running as root, can not fill a filesystem and potentially break other things that need to write to said filesystem - though services running as root still can still make it completely full of course.

It also give you some space to work with when users complain that the disk is full, or services start failing because the filesystem is full. For instance you could archive some files off into zip/gz/7zip archives before removing them (though if the filesystem were completely full, chances are you have some other filesystem available that you could create the archive file in instead).

5% has been the default for a long time, from back when disks were far smaller (tens of megabytes rather then hundreds of gigabytes) so 5% wasn't all that much. Luckily it can easily be tuned down to a smaller percentage as you say, or set to a specific number of blocks if you use tune2fs's -r option instead of -m. In both cases you can give a parameter of 0 to turn the reservation off completely - I wouldn't do this for /, /tmp, /var and so forth, but you might want to for a filesystem that only acts as user storage (say a global file-share) or one that just holds fixed size files (like fixed sized VMs) that will only grow when you create a new one.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .