Table of Contents

Running fsck in CentOS 5

It is apparently a very bad idea to run fsck on a mounted filesystem, even via single user mode. There are two good options for running it:

Boot from a CD

Boot from a CD with CentOS on it, and run it from the CD. Then none of your filesystems are mounted.

To do this, boot into Linux Rescue Mode:

boot: linux rescue

DO NOT mount your filesystems when it asks you if you want to. As noted above, you can't run fsck on a mounted filesystem.

Once you're in rescue mode, run fsck on the correct partition:

fsck -f /dev/sda1

If you've used the Linux LVM to create your partitions, you'll need to make those accessible before you run fsck:

lvm pvscan
lvm vgscan
lvm lvchange -ay VolGroup00
lvm lvscan

Then you can run fsck:

fsck -f /dev/VolGroup00/LogVol00 

Run on restart

If you type

bash# shutdown -Fr now

then CentOS will reboot and do a forced fsck, which will be done before the filesystems are mounted.