How to configure fsck to run automatically - Printable Version +- Linux Lite Forums (https://www.freecinema2022.gq/forums) +-- Forum: Software - Support (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=5) +--- Forum: Other (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=20) +--- Thread: How to configure fsck to run automatically (/showthread.php?tid=4116) |
How to configure fsck to run automatically - skippy95 - 05-31-2017 Questions: Is fsck already configured to run after a certain amount of time or number of mounts? If so, what command will show this? If not, how do I configure fsck to run and fix errors after a certain number of mounts? Is fsck configured to run and fix errors after a forced shutdown? If not, how do I configure fsck to to run and fix errors after a forced shut down? Should fsck be configured to run for these cases on a separate /home partition? What I want to accomplish: - fsck to auto run on /dev/sda1 and /dev/sda3 after so many boots and automatically fix errors. - fsck to auto run on /dev/sda1 and /dev/sda3 after a forced shut down and automatically fix errors. I'm running linux lite 3.4. I've been trying to figure out if fsck is already comfigured to run for the above cases, but I'm just not sure. Also, my thinking is that, since /sda3 is a data partition with its own file system, and it mounts at boot, then fsck should be run on this part as well - please correct me if I'm wrong. I don't know if it's necessary, but I'm including some output I've been looking at. All output is default from installation, I haven't change anything. I'm still a newbie at this, and your help and information is greatly appreciated as I want to learn, and I want to learn to do it right. Contents of /etc/init/mountall: Code: script Contents of /etc/default/rcS: Code: # automatically repair filesystems with inconsistencies during boot Contents of /etc/fstab: Code: # / was on /dev/sda1 during installation Contents of /proc/mounts: Code: /dev/sda1 / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0 Output of tune2fs -l /dev/sda1: Note: Last checked date value equals date and time of installation. Code: Errors behavior: Continue Output of tune2fs -l /dev/sda3 Note: Last checked date value equals date and time of installation. Code: Errors behavior: Continue Contents of /var/log/boot.log: Note: boot.log shows a modified date of today. Code: /dev/sda1: clean, 217267/1638400 files, 1317759/6553600 blocks Re: How to configure fsck to run automatically - elelme - 06-02-2017 Skippy95, I have been waiting for one of the learned folk here to answer this, because it was a good question ...Have you figured it out? Re: How to configure fsck to run automatically - skippy95 - 06-02-2017 elelme, no I haven't come up with a definitive answer yet. Continuing to read and re-read man pages, trying to piece it together. If and when I do find an answer, I'll post back here. Re: How to configure fsck to run automatically - supergamer - 06-02-2017 I'm not on a linutlite install right now but I will check to be sure later but really this should be easy. Go to the /etc/init.d folder and look for the checkfs.sh script. Open it up with a text editor using sudo and change the line that says FSCKFIX=no to FSCKFIX=yes. Now add a line to the rcS file to start the script after things are mounted. The line might look like: Code: cd /etc/init.d && ./checkfs.sh Re: How to configure fsck to run automatically - elelme - 06-03-2017 Wow, skippy95, glad to see supergamer come into this with at least a good suggestion. (I edited out a dumb question of why not just rebooting them occasionally, which totally missed the point. Will look forward to your solution. ) Re: How to configure fsck to run automatically - skippy95 - 06-03-2017 Hi [size=1em]supergamer, thanks for the info. [/size]I edited /etc/init.d/checkfs.sh from FSCKFIX=no to FSCKFIX=yes. Then I edited /etc/default/rcS by adding the line Code: cd /etc/init.d && ./checkfs.sh After reboot, I found these lines in the syslog, so I'm guessing something went wrong: Code: ondemand[685]: ./checkfs.sh: 27: /etc/default/rcS: Cannot fork After reboot, the desktop was slow in responding, don't know why? I don't know much about bash scripts, so I'm hesitant to do any other edits on my own. Hi, elelme. Hang in there, I'm going to keep at it until I find all the answers. Grab a drink, 'cause this may take a while Oh yeah, no such thing as a dumb question. It's how I learn. Re: How to configure fsck to run automatically - supergamer - 06-03-2017 Please undo everything and read this: https://unix.stackexchange.com/questions/123963/how-to-force-fsck-at-every-boot-all-relevant-filesystems The last solution seems likely what you want with adding a command to grub. Edit: You still may have to modify the checkfs.sh file to FSCKFIX=yes Re: How to configure fsck to run automatically - supergamer - 06-03-2017 You can probably also add: Code: sudo tune2fs -c 1 /dev/sdX To both of the files (halt and reboot) in the /etc/init.d before the last line. There seems to be several ways to do this and I am not sure on which one would be the easiest or safest. Re: How to configure fsck to run automatically - skippy95 - 06-08-2017 Thanks for the help and link supergamer. This is what I did: In the file /etc/default/grub: I changed this line: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash fsck.mode=force fsck.repair=yes" then: sudo update-grub fsck.mode=force is forcing a filesystem check at each boot. fsck.repair=yes is forcing repairs at each check. |