Walker News

Tune2fs Command May Increase Linux Free Disk Space

Not all of the Linux distributions allow users to tweak file system parameters during Linux installation, such as file system Reserved Block Count. Debian Linux installer allows user to change file system Reserved Block Count at Linux installation stage.

Other Linux distributions, particularly Redhat Linux, only allow user to tune file system parameters at post-installation stage, via Linux file system utility tune2fs.

Debian Sarge installer allows user to tweak file system reserved block count during Debian installation

Linux df command output shows that the sum of total used disk space and total available free disk space is not equal to or tally with total size of file system or partition.

As shown in the screenshot (above), the “glitch” of Linux df command output: The sum of Used column and Avail column is not tally with or equal to Size column.
File system Reserved Block Count is supposed to reduce Linux file system defragmentation, to allow root user login for maintenance or to allow Linux system logging facility to function properly in case file system running low of free disk space.

How to reduce Linux ext2 /ext3 file system Reserved Block Count?

File system utility tune2fs can be used to tune Linux ext2 / ext3 file system parameters, such as adjusting file system reserved block count, frequency of file system force-check based, maximal time between two file system checks, behavior of the kernel code when errors are detected, overriding the default ext3 journal parameters, etc.
tune2fs -l /dev/hda

dumpe2fs -h /dev/vg0/lvol1

can be used to inspect the Linux file system superblock information. Take note on these properties returned by tune2fs or dumpe2fs command:

Reserved block count: 3399024
Free blocks: 4997248
Free inodes: 42473835
First block: 0
Block size: 4096

The block size is measured in byte unit. In this case, it’s 4,096 byte or 4KB. So, the Reserved Block Count: 3399024 is equal to 13,922,402,304 byte or roughly equivalent to 14GB.

Now, if execute the command
tune2fs -m 0 /dev/vg0/lvol1

will set the percentage of file system reserved block count to 0% for /dev/vg0/lvol1 file system (the first column of df command output).

It’s OK to totally disable file system reserved block count, if the file system is not used by root user account or storing system log and system/program temp files (e.g. /var and /tmp).  For example, file system dedicated to host database table files, Samba shares, movie or music files, etc, are safe to disable file system reserved block count.

So, if you’re running a Linux machine with 320GB SATA hard disk that storing tones of movie and mp3 files, and haven’t tune the file system reserved block count, you may tune it now to claim back as much as 16GB of free disk space!

Custom Search

  1. Download Official Redhat Linux ISO Image – Walker News 22-06-07@21:56

    [...] Linux is one of the many Linux distributions and one of few open-source OS with enterprise class of technical support. Indeed, [...]

  2. Create New Linux EXT3 File System In LVM – Walker News 11-07-07@17:21

    [...] Now, create the new EXT3 file system on the new logical volume (LV) with 1% file system reserved block count: [...]

  3. How To Fix DB2 SQL6048N Error Of DB2START – Walker News 07-09-07@00:04

    [...] from the ground up, I planned to install only one DB2 server and then replicate its RAID1 SCSI hard disk to the [...]

  4. Linux: How To Backup And Restore Directory With Tar Over SSH Connection? – Walker News 06-11-08@01:53

    [...] some directories on live machine and restore them to DR box. Problem is that the live system has insufficient free disk space to create tarball (tar archive or .tar file), as some of the directories are bulky. In this [...]

  5. den 05-02-10@04:04

    Very helpful… thx.

2014  •  Privacy Policy