Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Use tune2fs to save space in your partitions or external drives  (Read 5226 times)

0 Members and 1 Guest are viewing this topic.

dustin

  • Guest
Use tune2fs to save space in your partitions or external drives
« on: October 25, 2013, 10:24:34 pm »
 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 your 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.

steps:

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  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.