3

I'd like to force a verbose fsck on reboot of my Ubuntu linux server, I can get fsck to run on reboot by creating a file /forcefsck in my root dir ...

Additionally, by adding a y into the contents of the /forcefsck file my server will (properly) run fsck on reboot without any user interaction but every time I reboot (and let the auto fsck run) and then do ...

fsck -nvf /dev/somedisk

I still have the disk errors I had before, I even tried putting yvf in the text of the /forcefsck file with no luck.

Is there a simple way for me to force a verbose fsck on reboot?

Note: I've watched the fsck running at reboot and it does not come up with the same errors I get when I run fsck -nvf /dev/somedisk ?

Update: This is a remote server ...

Justin Jenkins
  • 158
  • 1
  • 1
  • 7

3 Answers3

3

The /forcefsck file's contents isn't examined anywhere only the presence in the script /etc/init/mountall.conf and itf this file is present then the --force-fsck option is added to the mountall program. It's man is a bit short but if you run mountall --help then it shows that it has a --verbose option. You can change the /etc/init/mountall.conf file to run the mountall with --verbose option maybe it will show you more. Not sure, I haven't tried it myself.

But the best if you just boot the system from a LiveCD and repair your filesystem from there.

Stone
  • 6,941
  • 1
  • 19
  • 33
  • I will look into this, thanks ... for the record this is a remote machine so I can't use LiveCD ... – Justin Jenkins Feb 06 '13 at 09:22
  • You can write a custom startup script to run before mountall to do fsck for you with your desired options. – Stone Feb 06 '13 at 11:03
  • Where would this startup script go? Is there a `rc runlevel` that I can know will fire before the root filesystem is mounted? – Justin Jenkins Feb 07 '13 at 03:24
  • Also of interest I saw here http://askubuntu.com/a/151742/4153 that `/etc/default/rcS` sets `$FSCKFIX` which is a variable used in the `mountall.conf` to set `fsck` "fix" errors. – Justin Jenkins Feb 07 '13 at 03:25
1

I guess there's a mistake on your command ... Check again fsck parameters on man: -n is for not updating! I'll try instead:

fsck -v /dev/somedisk

Joan
  • 11
  • 1
  • `fsck -nvf /dev/somedisk` is being used to *check* the disk for errors **after** the "forced" check is run ... it's not the command that is used to do the `fsck` in the first place. – Justin Jenkins Mar 11 '14 at 21:16
0

If you want to do fsck of / filesystem, I can recommend you boot from Ubuntu install CD and on the basic screen choose 'Rescue mode'. You will have a basic system and from rescue you can do fsck of filesystem safely.

Another chance is, when you change in file /etc/default/rcS variable FSCKFIX to yes: it will run fsck on the filesystems with -y option.

Jan Marek
  • 2,120
  • 1
  • 13
  • 14