How to change the reserved blocks on EXT3 or EXT4 filesystem in Linux

Profile image of Mattias Geniar

Mattias Geniar, June 06, 2012

Follow me on Twitter as @mattiasgeniar

By default, an ext3 filesystem will reserve 5% of its capacity for special processes that can continue to run when diskspace is running low. Here’s the explanation according to the manual.

Specify the percentage of the filesystem blocks reserved for the super-user. This avoids fragmentation, and allows root-owned daemons, such as syslogd(8), to continue to function correctly after non-privi-leged processes are prevented from writing to the filesystem. The default percentage is 5%.

On large partitions (say 8TB+), losing 5% of these reserved blocks for only those processes is quite a lot.

Check your current reserved blocks on your disk

First, check which mount you want to investigate.

$  df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/partition        198G  180G   14G  93% /
/dev/sda1              99M   41M   54M  44% /boot
tmpfs                 2.0G     0  2.0G   0% /dev/shm

In this case, I want the root partition (/), so I’ll do the rest of the examples with /dev/partition.

You can check your current reserved blocks value with tune2fs.

$ tune2fs -l /dev/partition  | grep 'Reserved'
Reserved block count:     120542571

In this case, it means we’ve ‘lost’ the ability to use 120.542.571 blocks on the partition.

Lower Reserved Blocks by percentage

You can lower the 5% barrier if you like, but I only suggest doing this for larger partitions. Since the default is 5%, I’ll lower it to 2% here.

$ tune2fs -m2 /dev/partition
tune2fs 1.39 (29-May-2006)
Setting reserved blocks percentage to 2% (48223887 blocks)

With the ‘-m’ parameter you can specify a percentage amount of reserved blocks to keep for that purpose.

-m reserved-blocks-percentage

Set the percentage of reserved filesystem blocks.

After the command, the Reserved Blocks will be lower.

Lower Reserved Blocks by an absolute value

If you prefer to use a fixed set of blocks, instead of a percentage, use the -r parameter.

$ tune2fs -r 48223887 /dev/partition
tune2fs 1.39 (29-May-2006)
Setting reserved blocks percentage to 2% (48223887 blocks)

With the -r option you get more control, the -m allows you to change things quickly.

Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.