Increase available disk space by decreasing the reserved blocks in extended filesytems ext2/3/4 using tune2fs

Have you ever noticed that after formatting a partition or external storage device - hard disk etc. into ext2/3/4 decreases the total available disk space by some amount? That's because the file-system reserves some part of the space to privileged processes. This is done to make sure that in case of file-system fill up, when user processes may not be allowed to write to disk, privilege system processes(or root user) may still be able to function properly(write on disk) e.g. syslogd etc.

This space by default is around 5% of the total. And considering the amount of hard-drive or partitions available these days, this reserved memory could be huge e.g. 5% of 500GB hard disk is 25GB, which is too much for critical cases. And this memory is only needed in the root(/) partition and it doesn't make much sense to reserve blocks on /home partitions or external storage devices, because privileged processes don't usually write on home partition.

It should be noted that this reserved space is also used to reduce fragmentation. So, it plays a major role in avoiding fragmentation by preventing the disk to be filled completely.

So, if you think 5% of your partition/disk is more than enough for reserved blocks then you can save some space by decreasing this amount. You can do this by using the tune2fs utility.

[root]# tune2fs -m 3 /dev/sda1

The -m option is used to set the new percentage share, we used 3%. /dev/sda1 is my root(/) partition.

We can set the value to 0 for home partition, assuming that you haven't configured any privileged process to write in /home directory. A word of warning here, since these reserved blocks are also used to prevent fragmentation, leaving some amount is a good idea.

[root]# tune2fs -m 0 /dev/sda2

where /dev/sda2 is the home partition.

You can even check the current number of reserved blocks on a partition or disk using tune2fs.

[root]# tune2fs -l /dev/sda2 | grep -i reserve

Reserved block count:     1257387
Reserved GDT blocks:      1018
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)

3 Comments

Fahad (not verified)
October 21st, 2010 10:36 pm
thanks! I really needed this! :)
October 21st, 2010 11:21 pm

Hi Fahad, good to be of some help :). In case you have set the space to 0, then please re-visit the article, because I forgot to address the issue of these reserved blocks being an anti-fragmentation mechanism too, as pointed here. So, it would be good to leave some space reserved for them.

Anon Linuxer (not verified)
November 21st, 2010 03:38 am
Does anyone know of a similar feature to reserve some memory so if you do get an Out Of Memory situation you will still be able to login to the host and try and kill off the offenders?

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.