Last Updated: 27 Jun 2023

   |   

Author: dordal

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.

Discussion

Pendita, Aug 7, 2011 03:04 AM

thanks whoever you are..you really save my day…thanks again..works like charms…

Danny Long, Oct 4, 2011 10:49 PM

Thank you so much!

Juancho, May 2, 2012 09:22 PM

thanks works perfect.

test14.192.209.184, Apr 12, 2016 12:33 PM

i receive error couldn't open /etc/fstab: no such file or directory

Enter your comment. Wiki syntax is allowed: