Linux ext2/ext3/ext4 (ext from now on) file system will reserved 5% of partition space whenever you create the partition. This reserved space is said to be meant for system admins when space is maxed out and they could release it for emergency usage. The fact this, this space is seldom used and even not known by a lot of users. The 5% space is not much during the time when storage is like 250GB. However, when it comes with modern days with 4TB HDD, this becomes quite a large amount of unused storage waste.
On system partitions, you can leave 1% reserved and it haven’t cause me any problems for the past 5 years. This 5% is a lot when your HDD size is like 3TB. That’s a whopping 150GB of extra space per drive. When you have like 4 drives, it is 600GB!!! And in storage partition, you do not really need the reserved space. Setting it to 0% reserved is almost a no brainer.
So how do you free up the space? Will there be any data loss? Do I have to re-format my partition?
Well, the answer is EASY, NO and NO.
For partition already being used:
To free up the space, just run command below:
sudo tune2fs -m <new percentage> /dev/<partitionID>
* new percentage = how many % you want to reserve
** partitionID = how many
[cc lang=”bash” escaped=”true” width=”100%”]
[root@web1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 267G 37G 217G 15% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/md0 1008M 59M 899M 7% /boot
[root@web1 ~]# tune2fs -m 1 /dev/md2
tune2fs 1.41.12 (17-May-2010)
Setting reserved blocks percentage to 1% (709314 blocks)
[root@web1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 267G 37G 228G 14% /
tmpfs 16G 0 16G 0% /dev/shm
/dev/md0 1008M 59M 899M 7% /boot
[/cc]
Once done, you can continue to use your partition without any issue.
ps. You can see in the example, it works on an mdraid partition as well! 🙂
For partition during format:
While using mkfs command to format, you can set the reserved space parameter.
[cc lang=”bash” escaped=”true” width=”100%”]
mkfs.ext2 -m 0 /dev/sdc1
[/cc]
Above example set reserved space to 0%.
That’s it for reserved space. Easy and simple work that take less than 5 minutes. Totally useful in NAS environment when you have 4 x 4TB HDD. Whatever the space you save, try to always have redundancy for your storage like RAID1 or RAID5 or RAID6. Speaking of which, I have had a bit of study on this and revamp my storage redundancy strategy. This will be left on an entirely new post which I will do when I have the time.