Run fsck on mounted partition

fsck

Is there any possibility to run fsck if I have one ext3 partition /dev/sda1 only?
File system is in the read-only mode, reboot did not help – automatic fsck failed and manual one is required. I have root access to my VPS console. I can't use live CD and similar techniques but command prompt only.

I tried the following (for CentOS 5.6):

telinit S
mount -o remount,ro -t ext3 /dev/sda1 /
fsck -fyC /dev/sda1

It refuses to start fsck on the partition as it's mounted. Now, I understand where I was wrong (SF topic). Still, is there any way to get round this and avoiding use of fsck -n?

Thank you.

Best Answer

You want to boot into your initrd's shell and do the fsck from there, before the root filesystem is mounted. It might involve loading modules in order to get access to your partitions.

This is the reason why having multiple filesystems isn't an unnecessary luxury.

Related Topic