Home page of this blog

Tuesday, April 6, 2010

Reclaiming the reserved space from a big ext3/ext4 partition

When we have a 500 GB or 1 TB partition and it is formatted in ext3 or ext4, filesystem reserves 5 percent space by default

This is not a problem when the partition size is small, but 5 percent of a 500 GB partition is 25 GB and 5 percent of 1 TB is 50 GB

Fortunately we can reclaim the reserved space of an ext3/ext4 partition using tune2fs

We need to have root privileges to configure reserved space using tune2fs

General format for configuring reserved space using tune2fs is as follows

sudo tune2fs -m <new percentage> /dev/sd<X><N>

where

<new percentage> --> is the new reserved space we want to assign
<X> --> which hard disk
<N> --> is the partition number

To enumerate and check the partition name use

sudo fdisk -l

For example I have an ext3 partition of size 877.5 GB in first hard disk and it's name is sda6 as listed by fdisk

Screenshot showing sda6 free and available before reclaiming reserved space, which are different. Actual available is 811.3 but free is 855.8, which means around 44 GB is reserved



I use

sudo tune2fs -m 0 /dev/sda6

will set the reserved space to 0 percentage, here is the screenshot showing how I did that



After reclaiming reserved space, the free and available are equal, which you can see in following screenshot




 tune2fs works only with ext3/ext4 partitions.

I learned about reclaiming reserved space from arch wiki which can be browsed at

http://wiki.archlinux.org/index.php/Ext3_Filesystem_Tips



Caution: Any tune2fs parameters are extremely dangerous on mounted partitions,
but setting reserved space using tune2fs works fine on mounted partitions. It is safe to do any tune2fs only on partitions which are not mounted, mostly from a livecd session

4 comments:

  1. Thanks! Exactly what I was looking for.

    ReplyDelete
  2. Good post, thanks! Hope to read stuff about Meerkat soon.

    ReplyDelete
  3. It didn't do anything on my 12 TB volume that is missing about 100 GB.

    ReplyDelete
    Replies
    1. Is it to do with 1000 vs 1024 (manufacturers sell 1000 GB instead of 1024 GB)

      And not sure about tune2fs as it had been long since I used it

      Delete