Run fsck -y everytime at startup on my main partition Linux
772
I have an embedded linux system. I use grub2 for the boot loader. I would like to run an fsck -y /dev/sda on /dev/sda every time it boots--even when the system had a power loss and the reboot command was not used. How can I do this?
Are you using a particular distribution? On Debian based distributions it would be as simple as adjusting /etc/default/rcS and set FSCKFIX to yes.
If you want to force a full fsck after every boot, then you could simply write create an empty file named /forcefsck. Though I do not suggest you actually do this.
If there had been a power loss fsck will run anyway since the filesystem will not be marked as "clean". You can use tune2fs -c 1 /dev/sda to set the check-interval for ext2/3 to one. IMHO that should force an fsck on every boot.
Are you using a particular distribution? On Debian based distributions it would be as simple as adjusting
/etc/default/rcS
and setFSCKFIX
to yes.If you want to force a full fsck after every boot, then you could simply write create an empty file named
/forcefsck
. Though I do not suggest you actually do this.If there had been a power loss fsck will run anyway since the filesystem will not be marked as "clean". You can use
tune2fs -c 1 /dev/sda
to set the check-interval for ext2/3 to one. IMHO that should force an fsck on every boot.