Packetwatch.net

Commands for check disk on startup in Red Hat Enterprise Linux



Last modified: Oct. 25, 2009

Contents
1 - Summary
2 - General information
3 - Force check disk at startup
4 - View check disk information
5 - Modify counts and intervals


1 - Summary

This guide will show some commands that deal with check disks on startup in
Red Hat Enterprise Linux. It will show the command to force a check disk on
startup as well as how to view information on how often check disks will
happen. This has been tested in Red Hat Enterprise Linux 4 and 5.


2 - General information

Make sure you have the e2fsprogs packages installed.
# rpm -qa | grep e2fs
e2fsprogs-libs-*
e2fsprogs-devel-*
e2fsprogs-*

List the ext2/ext3 filesystems.
# mount | grep -E '(ext2|ext3)'
/dev/sda1 on / type ext3 (rw)
/dev/mapper/VolGroup00-LogVol00 on /data type ext3 (rw,nosuid,nodev)


3 - Force check disk at startup

To force a check disk on startup run the following commands and then reboot.
# su - root
# cd /
# touch /forcefsck
# shutdown -r now


4 - View check disk information

View check disk information for the ext2/ext3 filesystems.
# sudo /sbin/dumpe2fs -h /dev/mapper/VolGroup00-LogVol00
Password: 
dumpe2fs 1.39 (29-May-2006)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          b89aa3ee-900a-4bef-ba13-e282c7db9c27
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype 
needs_recovery sparse_super large_file
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              462159872
Block count:              462159872
Reserved block count:     23107993
Free blocks:              336639752
Free inodes:              456061039
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      913
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         32768
Inode blocks per group:   1024
Filesystem created:       Sat Feb  7 14:31:30 2009
Last mount time:          Thu Oct  1 18:47:13 2009
Last write time:          Thu Oct  1 18:47:13 2009
Mount count:              8
Maximum mount count:      -1
Last checked:             Tue Jun 30 18:09:19 2009
Check interval:           0 (<none>)
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      5ab66b8d-4337-46f5-8710-03c7e70a4ea3
Journal backup:           inode blocks
Journal size:             128M

Look for the following lines. Mount count is the number of times the filesystem
has been mounted. The maximum mount count is maximum number of times the
filesystem is mounted before it will be checked. If the maximum mount count is
set to 0 or -1 it will never be forced to be checked. Last checked is the last
time the filesystem was checked. Check interval is the maximum amount of time
between two filesystem checks. If check interval is set to 0 time-dependent
checking will be disabled.
Mount count:              8
Maximum mount count:      -1
Last checked:             Tue Jun 30 18:09:19 2009
Check interval:           0 (<none>)


5 - Modify counts and intervals

You can modify the maximum mount count and the check intervals by using
tune2fs. Set the maximum mount count to -1.
# sudo /sbin/tune2fs -c -1 /dev/mapper/VolGroup00-LogVol00
Password:
tune2fs 1.39 (29-May-2006)
Setting maximal mount count to -1

Set the check interval to 0.
# sudo /sbin/tune2fs -i 0 /dev/mapper/VolGroup00-LogVol00
Password:
tune2fs 1.39 (29-May-2006)
Setting interval between check 0 seconds


Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2024.