Jaime Frutos Morales's blog

14/12/2009

How to free disk space in ext2, ext3 and ext4 partitions

Filed under: Linux, SysAdmin — acidborg @ 18:42

When a disk partition is given format using ext2, ext3 or ext4, the filesystem reserves a 5% of its capacity by default for root-only processes to use. It is done to avoid filesystem fragmentation and to allow system daemons to continue writing to the filesystem even after non-privileged processes can’t. This is a good thing to have by default, but a 5% means 25GB on a 500GB drive and that’s too much.

You can reduce this percentage on the fly, without data loss or corruption, using tune2fs. For example, if you want to reduce the space reserved on your /dev/sda1 partition to a 2%, use this command: tune2fs -m 2 /dev/sda1

On non-root partitions like /home or media drives, no reserved space is needed, so you can free that space using this command (assuming that your home partition is /dev/sda3): tune2fs -m 0 /dev/sda3

NOTE: It is not recommended to free all the reserved space on your / partition.

Advertisements

Blog at WordPress.com.

%d bloggers like this: