Remounting a Hard Drive

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,113
Location
California
Remounting a Hard Drive

Remounting a Hard Drive Mini How-To
Jeff Lasman, [email protected] 07/22/04 10:02

Sometimes we discover that a drive mapping we thought would work for us didn't, and we have to remount a drive partition under another directory name. Doing this task can be the simplest thing in the world or you can easily make a mistake that will make your system unusable.

That said, here goes:

The following instructions work properly on the versions of RHL on which I've done them. I make no warranties unless I'm actually doing the work for you.

1) create a new mount point for the drive; in this case we'll use /newmountpoint

2) unmount the drive from the mount point at which it's currently mounted...

Presuming the partition you want to remount is the first partition hard on your second drive, in most cases you can do this:

# umount /dev/hdb1

If that doesn't work, then your second drive is probably not seen as hdb. In that case you may be able to figure out what it is seen as by checking the output of "df -h".

Once you've unmounted your drive using the umount command as above, mount it to the new /newmountpoint mounting point this way:

# mount /dev/hdb1 /newmountpoint

Then do some testing to make sure you can read and write to /newmountpoint

If you can, then everything is good so far.

Next make the necessary changes to the fstab file so the drive partition will get mounted properly when you reboot.

Usually all you have to do is change the old mount point, wherever it appears, to "/newmountpoint" (without the quotes).

Then relabel the partition so it'll get automatically loaded; if you've got an ext2 or ext3 filesystem you can do it this way:

e2label /dev/hdb1 /newmountpoint

Then reboot under controlled conditions (when you're actually at the data center, in case of system problems) to make sure it all works.

After the reboot, make sure the directory that was the old mount point is now empty, as it should be.Then delete that directory:

# rmdir /oldmountpoint

If you have any problems you should probably bring in someone to do it for you; there's too much opportunity to break your filesystem and make your system unbootable.
 
Back
Top