0

My server running Debian lenny has just had a power cut recently and its come back up with the root partition in read only mode. I tried to remount the filesystem in read write mode with mount -n -o remount,rw / which then gave the output mount: block device /dev/hda1 is write-protected, mounting read-only.

But now the root filesystem isn't mounted at all so I can't run anything to mount the partition again or any other command for that matter such as shutdown because /bin/ isn't there.

Is there anything I can do remotely?

Jack
  • 131
  • 1
  • 6

1 Answers1

3

You might be able to use something in usr (assuming that's still mounted).

But one thing you can do is use magic SysRq keys if it's compiled into your kernel.

echo 1 > /proc/sys/kernel/sysrq
echo e > /proc/sysrq-trigger
echo i > /proc/sysrq-trigger
echo s > /proc/sysrq-trigger
echo u > /proc/sysrq-trigger
echo b > /proc/sysrq-trigger

You should wait for around thirty seconds or so between commands (a few minutes after e).

This will terminate processes (e), kill any processes that haven't yet terminated (i), sync disks (s), unmount disks (u), and finally reboot your server (b). Hopefully that'll give you another chance at fixing it without needing physical access.

Michael Lowman
  • 3,584
  • 19
  • 36
  • I'd try that but due to the bad disks which need fsck'ing is there any way to make sure thats forced and to automatically fix the errors, i'd rather it not sit there for input when it reboots due to fsck – Jack Jan 06 '11 at 14:51
  • well, the way I know to run an fsck is to touch /forcefsck... which isn't really an option for you ;) even so, i don't think there's any way to force fsck in non-interactive mode. I'd try the magic sysrq and just go out there if that doesn't work. good luck – Michael Lowman Jan 06 '11 at 14:56
  • I can get access to it in a few hours so, it's not too bad I guess. I'll go for it now. – Jack Jan 06 '11 at 14:59