Use tune2fs to save space in your partitions or external drives

  6 years ago

Have you ever noted that if you create a new partition on your hdd or external drive and format it in ext2,3,4 file format a few gigabytes of yor drive will be missing, even if you do not have any file on it?

This happens because ext2, ext3, ex4 filesystem by default allocate 5%-7% of the available blocks for use by the root user. This allows the system to continue running if non-root users fill up the file system and also assists in preventing file fragmentation because the filesystem does not fill up completely.

While this is vital on system partition or / partitions, you will not need it on your spare partitions that you use for your data or external drives formated in ext2,3,4.

You can change the block size of those partitions or external drives with two simple commands with the help of tune2fs without the need to reformat. As a result a you will save a few gigabytes.

Here is what you have to do:

1. Make sure that the partition you want to reclaim reserved space is mounted.

2. Find the partition name you are interested with the following command:

  • mount|grep ^'/dev'

It could be /dev/sda(b)2,3 etc. Lets say that the partition we need is /dev/sda2

3. Change the block size of /dev/sda2 with the following command:

  • sudo tune2fs -m 0 /dev/sda2

With this command we are setting dhe block size to 0.

Enter your admin password and done. To see the changes simply compare the free disk space before and after the last command and you will see a few more gigs at your disposition.

Do not use this on system partitions but only on extra partition, data partition or external drives formated in ext2,3,4.

Enjoy your extra space on your spare partitions or external drives! :)