Wednesday, 3 June 2015

FILESYSTEM: How to reduce reserved space in ext2, ext3 and ext4 using tune2fs

You might have noticed,  after formatting a partition using ext2,ext3 or ext4, the total available size will be reduced by a certain amount.

This happens because, by default the file-system reserves some part of the space to privileged processes. This is to make sure that, in case if the partition becomes full, and user processes may not be allowed to write to disk, privilege system processes(including root) may still be able to work properly(write on disk) . Example:  syslogd.

By default 5% of the total space, is allocated as reserved space.  This may be a waste of valuable space if the partition size is huge.

For example, for a 500 GB harddisk, 5% comes to 25 GB.  Normally, privileged process never run in partitions like "/home", so it  is not a good idea to reserve 5% of space on such partitions.

You can see the reserved blocks in a partition using "tune2fs"  as below:
--------
tune2fs -l  <partition> | grep -i reserve

The below snapshot shows such an example:



In the above case "/dev/mapper/VG_DAS_1-opt_oracle" is an LVM partition. It's available size is 14GB as below:
--------


Now, I am going to reduce the reserved space to 3% as below:

Syntax:
------
tune2fs -m < % of reserved space>  <partition name>
-------


As a result of this, the available space has been increased to 15 GB from 14 GB as below:



We can reduce the reserved space to even 0% but is is always recommended to keep at least 2-3% of total space as reserved.

Kool :)

No comments:

Post a comment

Note: only a member of this blog may post a comment.