티스토리 뷰

Study/System

Disable FSCK on Linux

pursh 2018. 2. 22. 10:05

참조 : http://unixadminguide.blogspot.kr/2013/12/how-to-disable-fsck-on-reboot-in-linux.html


How to disable fsck on reboot in linux


In Linux, when a filesystem is mounted for certain times, or its last fsck was more than certain days ago, system will perform fsck on it when server reboot. The fsck process can take a few minutes to hours to finish, depending on the filesystem size.


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. 

1. Filesystem tunable

2. Grub boot parameter

3. Placing command files on your root device

4. Update /etc/fstab

5. Active reboot without FSCK

6.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'

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


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.


To disable fsck check on /dev/sda2

$ tune2fs -c 0 -i 0 /dev/sda2

tune2fs 1.41.12 (17-May-2010)

Setting maximal mount count to -1

Setting interval between checks to 0 seconds.

check it again:


$ 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.

'Study > System' 카테고리의 다른 글

Linux에 static route 추가하기  (0) 2022.01.06
MAN Page - pam_tally2  (0) 2019.07.19
rpm 패키지 관리  (0) 2017.09.12
bash parameter expansion(변수 값 수정)  (0) 2017.08.10
MegaCli LSI  (0) 2017.05.08
댓글