How to force fsck on boot?
Peter Stoddard
peter at stoddard.us
Wed Dec 7 22:45:58 UTC 2005
Thanks for all the replies. Here is a summary:
(1) shutdown -r -F now
(2) Creating file "forcefsck" in the root directory should cause an fsck
to be run on next reboot. Works on RedHat and breezy too.
(3) tune2fs
I think the following grub suggestion applies only to x86 hardware:
(4) Choose rescue mode from the grub prompt at boot time to boot into
single user mode, or you can switch to single user mode after the system
boots up by running init 1 ( as root ). Once in single user mode, you
should be able to remount the filesystem as read only, fsck it, then
reboot.
To this list I'll add
(5) Edit /etc/fstab, although I'll have to experiment with that.
Someone asked why I want to force an fsck at all. I get what seems to
be an error message when I do a "find" starting at the root level, but
not when the "find" is started at a higher level. For example:
root at daphne:/etc# find /etc -name smb.conf -print
/etc/samba/smb.conf
root at daphne:/etc# find / -name smb.conf
/etc/samba/smb.conf
/var/cache/setup-tool-backends/backup/network/First/etc/samba/smb.conf
/var/cache/setup-tool-backends/backup/network/1/etc/samba/smb.conf
/var/cache/setup-tool-backends/backup/network/2/etc/samba/smb.conf
/var/cache/setup-tool-backends/backup/shares/First/etc/samba/smb.conf
/usr/share/samba/smb.conf
find: WARNING: Hard link count is wrong for /proc: this may be a bug in
your filesystem driver. Automatically turning on find's -noleaf option.
Earlier results may have failed to include directories that should have
been searched.
root at daphne:/etc#
I wanted to do an fsck to see if it would clear up that error message.
It didn't.
The fsck might be redundant in a journaled filesystem, I'm not sure.
Any comments welcomed.
Pete
More information about the ubuntu-users
mailing list