Archive for the tag 'tune2fs'

tune2fs - adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems

tune2fs allows the system administrator to adjust various tunable filesystem parameters on Linux ext2, ext3, or ext4 filesystems.

The current values of these options can be displayed by using the -l option to tune2fs(8) program, or by using the dumpe2fs(8) program.

-c max-mount-counts

Adjust the number of mounts after which the filesystem will be checked by e2fsck(8). If max-mount-counts is 0 or -1, the number of times the filesystem is mounted will be disregarded by e2fsck(8) and the kernel.Staggering the mount-counts at which filesystems are forcibly checked will avoid all filesystems being checked at one time when using journaled filesystems.

-C mount-count

Set the number of times the filesystem has been mounted. If set to a greater value than the max-mount-counts parameter set by the -c option, e2fsck(8) will check the filesystem at the next reboot.

Getting the current Values:

[root@proxy ~]# tune2fs -l /dev/sdb1 |grep count
Inode count: 655360
Block count: 2620595
Reserved block count: 131029
Mount count: 12
Maximum mount count: 26
[root@proxy ~]#

Example:

So for a system that contains 5 partitions and is booted approximately once a month you could do the following to stagger the mount counts:

tune2fs -c 5 -C 0 partition1
tune2fs -c 5 -C 1 partition2
tune2fs -c 5 -C 2 partition3
tune2fs -c 5 -C 3 partition4
tune2fs -c 5 -C 4 partition5

SBDavid

Using tune2fs to free up disk space.

Using tune2fs to free up disk space.

We usually encounter issues, where a partition becomes 100% full, say if you get / as 100%, you even can’t edit the fstab entries.

In such instance, you can use the tune2fs command to free up disk space, since for every file system under Unix, approximately 5% of disk space is reserved for the “root” user.

To check this, take the ratio of Block count to the Reserved block count. (these values can be obtained by listing the information in the specified file system’s superblock.

tune2fs -l /dev/device (it should be a partition actually)

To free up all the reserved space use,

tune2fs -m 0 /dev/device, instead of 0, you can specify 1 or 2.

The only risk in setting zero reserved blocks is that, other Unix users can fill the file system to 100%.