Remounting fs as read-write

I tried to add a second hard drive to my Suse PC, but after I partitioned it and formatted it as /usr (selected by Suse as default) I discovered a lot of my installed programs were nowhere to be found. I tried rebooting but I could no longer get to a desktop, so I removed the second hard drive again, thinking it would all be back to normal. However it now goes into a "diagnostic mode", and asks me to "do" bash# mount -n -o remount,rw /
but when I type this line I get bash#: Command not found.  How do I repair all my senseless vandalism? Or will I have to reinstall Suse off discs and start from scratch?

---

Leave out "bash#" as that only indicates a root bash prompt....you want to be typing just:
mount -n -o remount,rw /
FYI you may see command on this and other forums given with a prompt, a "#" indicates a root prompt and a "$" is for just a regular user, eg:
# mount -n -o remount,rw /
or
$ ls /home/user
When using these commands leave out the # or $.

---

Just looking at what caused the problem in the first place. The problem happened because you formatted the drive and didn't copy over the contents of /usr to it. When you now boot the system it mounts the empty drive under /usr....so you no longer have /usr/bin, /usr/lib, /usr/local, /usr/sbin, /usr/share etc.

I would fix it the following way:

1) Boot into "diagnostic mode" or use a live CD like knoppix, just so that you can have access to your root file system.

2) To fix it so you can boot suse again edit /etc/fstab. You want to comment out the line with /usr in it. To comment out the line just put a # at the beginning. It should look something like:
#/dev/hdb1 /usr reiserfs defaults 1 1
You should now be able to reboot and get back into suse.

3) Create a temp mount point for it and mount it:
# mkdir /mnt/temp
# mount /dev/hdb1 /mnt/temp
I am guessing that /dev/hdb1 is correct. You may have to alter this to reflect your system, the correct device will be on the same line in /etc/fstab as /usr.

4) Copy over the entire contents of your /usr to the new drive:
# cp -r /usr/* /mnt/temp

5) Make a cup of tea, walk the dog or have a beer! ;)

6) Once copying has finished, mount the drive in the correct place and test:
# umount /mnt/temp
# mount /dev/hdb1 /usr
# ls /usr
You should be able to read the contents.

7) Uncomment that line from /etc/fstab so that the drive is mounted automatically when booting.

Quick Links:
Have a Linux Problem
Linux Forum - Do you have a Linux Question?

Frequently Used Options
See also common Linux Commands

Linux Books
Linux Certification, System Administration, Programming, Networking Books

Hints and Tips on: Linux System Administration

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.