6

So, I tried to mount a hard disk /dev/sdc2 on / directory in my Ubuntu workstation, and upon mounting, I am not able to remote into the Ubuntu workstation anymore. The exact command I run to mount is

sudo mount /dev/sdc2 /

I am not sure what has gone wrong, but I thought mounting a hard disk on / directory is fine. From what I read, it does not erase all the files and folders in / directory.

I was so anxious and I am only allowed to return to office to unplug the hard disk to see whether I can remote into my Ubuntu workstation again after unplugging. Any insight into this issue is much appreciated! :)

0

2 Answers 2

12

Unfortunately, mounting any filesystem on the / mount-point of a running Linux installation is fatal, unless that newly-mounted filesystem happens to contain in itself a complete Linux installation (and even then it is a bad idea).

The reason is as follows:

  • / is the root mount point to which the entire filesystem tree of the OS is attached, including configuration files, pseudo-filesystems for accounting, and the binary executables of any and all commands that don't happen to be builtin commands of your shell.
  • If you mount anything to a mount-point where another filsystem is already attached, the previous filesystem content is shadowed by the content of the new filesystem.

That means that while the original installation is still on your hard-drive, your operating system instead sees the contents of /dev/sdc2 where it would expect the OS. This in effect makes it completely inoperative.

Since you cannot call any command anymore (remember, the shell would try to locate the executable file from a filesystem in no longer sees) your only choice is to try the "Magic SysRq keystroke":

  • Press Alt+SysRq and while keeping both pressed, press in addition the sequence R E I S U B. A nice mnemonic mentioned by @TooTea for that sequence is "Reboot Even If System Utterly Broken".

This will instruct the running kernel to try to sync and shutdown the system in as orderly a way as possible (but if that doesn't work, your only choice is a hard power-off). You can then start the computer again - since you didn't modify the fstab to mount /dev/sdc2, it will boot again with the original filesystem where your OS is installed mounted as /.

For the future, the "dedicated" mount-point to temporarily attach hard-drives is /mnt.

0
2

Press Alt + SysRQ + REISUB or SUB.

Don't do that ever again - you basically override your running system and your currently running applications are not aware of the fact that the underlying system has been effectively removed.

0

You must log in to answer this question.

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