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 ...

  • What't the root fs? ext2/3/4? – ott-- Feb 6 '13 at 10:39
  • The root fs is ext3 – Justin Jenkins Feb 6 '13 at 18:16

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.

  • I will look into this, thanks ... for the record this is a remote machine so I can't use LiveCD ... – Justin Jenkins Feb 6 '13 at 9:22
  • You can write a custom startup script to run before mountall to do fsck for you with your desired options. – Stone Feb 6 '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 7 '13 at 3:24
  • Also of interest I saw here 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 7 '13 at 3:25

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

  • 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

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.

  • Thanks, but this is on a remote server so I don't have that option .... – Justin Jenkins Feb 6 '13 at 9:20
  • @JustinJenkins please, check my answer - I've added another one advice. – Jan Marek Feb 11 '13 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.