0

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.

2 Answers 2

1

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.

2
  • I believe that CentOS's default initrd doesn't have a shell built into it.
    – anastrophe
    Aug 23, 2011 at 6:16
  • @womble I have tried searching for initrd.img but without success. I know that I can pass /boot/initrd.img to the loader to access initrd shell. But I do not have it. Would you be so kind to share your experience of how to 'tie' this shell to modern distributives?
    – Andrew
    Aug 23, 2011 at 15:26
0

Don't you want

mount -o remount,rw -t ext3 /dev/sda1

?

fsck will refuse to run except in a non-writing mode, because you're remounting read-only. Yes?

4
  • No, it won't. The SF question the OP linked to will explain more.
    – womble
    Aug 23, 2011 at 5:56
  • If you're in single user, dumped there because fsck on boot couldn't fix automatically, then you remount rw, and run fsck. I've done this, successfully, on CentOS 5.x (I believe 5.4 - it's been a while). If your machine is toastfully unresponsive due to unfixable disk errors, then you've got nothing to lose by forcing fsck in single user mode. The risks are effectively meaningless, since you've already entered the World of Hurt.
    – anastrophe
    Aug 23, 2011 at 6:11
  • 1
    The risk would still be lower if you fscked a read-only mounted filesystem, and fsck doesn't refuse to write because it's mounted read-only, because it doesn't read/write via the VFS layer.
    – womble
    Aug 23, 2011 at 6:28
  • @womble Your point is right. There is no a thought to start fsck on the production server mounted in read-write mode.
    – Andrew
    Aug 23, 2011 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .