Managing your file system

We can use dumpe2fs utility to get info about our partition/drive.

This command will extract the details about the check interval.

dumpe2fs -h<span style="color: #ff0000;"> /dev/XXXx</span> | grep "Check interval"
or 
<strong>tune2fs -l /dev/sda1</strong>

To change this setting, you can issue this command, where NN is the number of mounts before re-checking it:

tune2fs -c <span style="color: #0000ff;"><em><strong>NN</strong></em></span> <span style="color: #ff0000;"> /dev/XXXx</span>

You can change the maximum number of mounts allowed before a full check is forced using the -c option, or change the interval between full checks with the -i option. The interval can be specified in days, months or weeks by appending a d, m or w to the number.

# tune2fs -c 10 /dev/hdd1

tune2fs 1.39 (29-May-2006)
Setting maximal mount count to 10

# tune2fs -i 30d /dev/hdd1

Source: http://www.dba-oracle.com/t_linux_tune2fs.htm

Change Filesystem Volume Name

Using the “-L” parameter, we can give add/change the filesystem volume name.

# tune2fs -L Disk_One /dev/sda1
tune2fs 1.41.9 (22-Aug-2009)

# tune2fs -l /dev/sda1 | grep volume
Filesystem volume name:   Disk_One

 

Displaying Filesystem Check Intervals and Mount Counts

By default, most systems will automatically attempt to check your filesystems after a defined time limit. This may be the number of times a filesystem has been mounted or literally a set time. To display the current settings we can use the “tune2fs” command and grep for “interval” and “count”.

# tune2fs -l /dev/sda1 |grep interval
Check interval:           15552000 (6 months)

# tune2fs -l /dev/sda1 |grep -i count
Inode count:              9609216
Block count:              38419456
Reserved block count:     1920972
Mount count:              6
Maximum mount count:      35

 

Disable Filesystem Check on Boot

The following parameters should only be used in a test environment where you may be carrying out multiple reboots during the course of the day. The Mount Count and check interval values below are set to “-1” which disables any checking!

tune2fs -c -1 /dev/sda1

tune2fs -i -1 /dev/sda1

 

Modifying Filesystem Checks

The following will modify the Check interval and Mount Count to only check after 100 mounts or a 2 month period.

tune2fs -c 100 -i 2m /dev/sda1

Staggering the mount counts at which filesystems are checked can avoid all filesystems being checked at one time. This will avoid all filesystems being checked at the same time and can reduce boot time.