How to disable fsck on reboot in linux
If we want fast reboot, we can disable the fsck check, although it's not recommended to do so.
There’s several ways of accomplishing this. I will list all the methods beneath, just pick the one that fits the situation/you.
- Filesystem tunable
- Grub boot parameter
- Placing command files on your root device
- Update /etc/fstab
- Active reboot without FSCK
Filesystem tunable
Use the tune2fs command to tell your filesystem to have a max count of mounts before a check to 0 to disable it.
# tune2fs -c 0 /dev/sda2
To list the current settings: $ tune2fs /dev/sda2 | egrep -i 'mount count|check'the output is self-explained, for my system, /dev/sda2 will be checked after it's mounted for 21 times, or after Sep 20 16:15:33 2012.
Mount count: 1
Maximum mount count: 21
Last checked: Sat Mar 24 16:15:33 2012
Check interval: 15552000 (6 months)
Next check after: Thu Sep 20 16:15:33 2012
To disable fsck check on /dev/sda2
$ tune2fs -c 0 -i 0 /dev/sda2check it again:
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds.
$ tune2fs /dev/sda2 | egrep -i 'mount count|check'
Mount count: 1
Maximum mount count: -1
Last checked: Sat Mar 24 16:15:33 2012
Check interval: 0 (<none>)
Grub boot parameter
Add the following at the end of your grub boot linux line.
fastboot
This can be done by editing “grub.conf” or by editing the boot command via the grub menu at boot.
Placing command files on your root device
To disable the filesystem check on boot.
# touch /fastboot
To enable a filesystem check on boot.
# touch /forcefsck
update /etc/fstab
in /etc/fstab, the last column is used by fsck to determine the order
of performing file system check at reboot time. For root file system /,
it should be 1, for other file systems, it should be 2. If we want to
disable the fsck check for certain file system, we can specify 0 in the
last column.
$ grep nofsck /etc/fstab
/dev/sda2 /mnt/nofsck ext4 defaults 0 0
Active reboot without FSCK
# shutdown -rf
Parameter reference:
-r Reboot after shutdown.
-f Skip fsck on reboot.
the -f flags tells system to skip fsck for all filesystems during the reboot. Unlike the fstab and tune2fs methods, it only takes effect during current reboot, will not disable fsck permanently.
we can activate an automatic root filesystem check on every start/stop by changing the entry
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1(last digit changed from 0 (skip check) to 1 (check this with highest prio)) in file
/etc/fstab
and also changing in /etc/default/rcS
the last entry to# automatically repair filesystems with inconsistencies during boot
FSCKFIX=yes
or
Code:
gksudo gedit /etc/default/rcS
Code:
FSCKFIX=yes