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.