You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



How to configure fsck to run automatically

Author (Read 9141 times)

0 Members and 2 Guests are viewing this topic.

Re: How to configure fsck to run automatically
« Reply #9 on: June 08, 2017, 03:45:15 PM »
 

skippy95

  • New to Forums
  • *
  • 20
    Posts
  • Reputation: 4
  • Linux Lite Member
    • View Profile
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.
 

Re: How to configure fsck to run automatically
« Reply #8 on: June 03, 2017, 04:43:05 PM »
 

supergamer

  • Forum Regular
  • ***
  • 163
    Posts
  • Reputation: 27
  • Linux Lite Member
    • View Profile

  • CPU: AMD Phenom 565

  • MEMORY: 12Gb

  • VIDEO CARD: 550 ti
You can probably also add:

Code: [Select]
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.

« Last Edit: June 03, 2017, 04:46:59 PM by supergamer »
 

Re: How to configure fsck to run automatically
« Reply #7 on: June 03, 2017, 04:13:46 PM »
 

supergamer

  • Forum Regular
  • ***
  • 163
    Posts
  • Reputation: 27
  • Linux Lite Member
    • View Profile

  • CPU: AMD Phenom 565

  • MEMORY: 12Gb

  • VIDEO CARD: 550 ti
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
« Last Edit: June 03, 2017, 04:29:25 PM by supergamer »
 

Re: How to configure fsck to run automatically
« Reply #6 on: June 03, 2017, 03:52:39 PM »
 

skippy95

  • New to Forums
  • *
  • 20
    Posts
  • Reputation: 4
  • Linux Lite Member
    • View Profile
Hi supergamer, thanks for the info. I edited /etc/init.d/checkfs.sh from FSCKFIX=no to FSCKFIX=yes. Then I edited /etc/default/rcS by adding the line
Code: [Select]
cd /etc/init.d && ./checkfs.sh
After reboot, I found these lines in the syslog, so I'm guessing something went wrong:
Code: [Select]
ondemand[685]: ./checkfs.sh: 27: /etc/default/rcS: Cannot fork
ondemand[685]: ./checkfs.sh: 8: /lib/lsb/init-functions.d/01-upstart-lsb: Cannot fork
grub-common[1520]: ./checkfs.sh: 27: /etc/default/rcS: Cannot fork
ondemand[685]: message repeated 161 times: [ ./checkfs.sh: 8: /lib/lsb/init-functions.d/01-upstart-lsb: 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.
« Last Edit: June 03, 2017, 03:55:01 PM by skippy95 »
 

Re: How to configure fsck to run automatically
« Reply #5 on: June 03, 2017, 01:03:15 PM »
 

elelme

  • Forum Regular
  • ***
  • 100
    Posts
  • Reputation: 11
  • Deleted
    • View Profile

  • Kernel: 5.x
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.  :D  )
 

Re: How to configure fsck to run automatically
« Reply #4 on: June 02, 2017, 03:53:50 PM »
 

supergamer

  • Forum Regular
  • ***
  • 163
    Posts
  • Reputation: 27
  • Linux Lite Member
    • View Profile

  • CPU: AMD Phenom 565

  • MEMORY: 12Gb

  • VIDEO CARD: 550 ti
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: [Select]
cd /etc/init.d && ./checkfs.sh
« Last Edit: June 02, 2017, 03:59:11 PM by supergamer »
 

Re: How to configure fsck to run automatically
« Reply #3 on: June 02, 2017, 03:41:23 PM »
 

skippy95

  • New to Forums
  • *
  • 20
    Posts
  • Reputation: 4
  • Linux Lite Member
    • View Profile
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
« Reply #2 on: June 02, 2017, 11:57:35 AM »
 

elelme

  • Forum Regular
  • ***
  • 100
    Posts
  • Reputation: 11
  • Deleted
    • View Profile

  • Kernel: 5.x
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?

   
« Last Edit: June 02, 2017, 12:01:00 PM by elelme »
 

How to configure fsck to run automatically
« Reply #1 on: May 31, 2017, 02:46:47 PM »
 

skippy95

  • New to Forums
  • *
  • 20
    Posts
  • Reputation: 4
  • Linux Lite Member
    • View Profile

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: [Select]
script
     . /etc/default/rcS || true
     [ -f /forcefsck ] && force_fsck="--force-fsck"
     [ "$FSCKFIX" = "yes" ] && fsck_fix="--fsck-fix"
     ...
end script


Contents of /etc/default/rcS:
Code: [Select]
# automatically repair filesystems with inconsistencies during boot
#FSCKFIX=no


Contents of /etc/fstab:
Code: [Select]
# / was on /dev/sda1 during installation
UUID=...     /     ext4     errors=remount-ro     0     1
# /home was on /dev/sda3 during installation
UUID=...   /home     ext4     defaults     0     2


Contents of /proc/mounts:
Code: [Select]
/dev/sda1     /     ext4    rw,relatime,errors=remount-ro,data=ordered     0     0
/dev/sda3     /home    ext4     rw,relatime,data=ordered     0     0


Output of tune2fs -l /dev/sda1:
Note: Last checked date value equals date and time of installation.
Code: [Select]
Errors behavior:  Continue
Mount count:  91
Maximum mount count:  -1
Last checked:  Mon May  8 08:12:12 2017
Check interval:  0 (<none>)


Output of tune2fs -l /dev/sda3
Note: Last checked date value equals date and time of installation.
Code: [Select]
Errors behavior:  Continue
Mount count:  98
Maximum mount count:  -1
Last checked:  Mon May  8 08:12:12 2017 (during installation)
Check interval:  0 (<none>)


Contents of /var/log/boot.log:
Note: boot.log shows a modified date of today.
Code: [Select]
/dev/sda1: clean, 217267/1638400 files, 1317759/6553600 blocks

 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section