On Linux and mounting hard drives

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

Post Reply
User avatar
Alferd Packer
Sith Marauder
Posts: 3706
Joined: 2002-07-19 09:22pm
Location: Slumgullion Pass
Contact:

On Linux and mounting hard drives

Post by Alferd Packer »

So, stupidly, I upgraded my Ubuntu 10.04 box to 10.10 and it broke hardcore. Fortunately, I have two 320 GB hard drives in my Linux box, and one of has been sitting idle for the last couple years. In a flash of genius, I decided I would do the following:

1. Install a fresh copy of 10.04 on the spare hard drive, hereafter referred to as /dev/sdb
2. Copy /home directories, samba config files, etc. from the busted 10.10 installation, which resides on /dev/sda
3. Never upgrade Ubuntu again.

So, I run the installation, everything goes fine. So as not to accidentally overwrite my data, I physically disconnect /dev/sda while in install to /dev/sdb. I reconnect the drive after I've successfully booted into the new 10.04 install.

Now, in the past, the spare 320 GB drive would be automagically mounted so that I could look at it. This time, however, /dev/sda wasn't anywhere to be found. When I checked in Ubuntu's Disk Utility, I saw it there. "Ok," I thought, "I'll just click on the button that says 'mount drive,' and...hey, what the hell is the error?"

The error I'm getting is that /dev/sda1 is already mounted to / . This, of course, cannot be, because because the Disk Utility says that /dev/sdb1 is mounted to /. So, I examine the contents of /etc/fstab. In there, it lists /dev/sda1 as already being mounted to /. Curiouser and curiouser.

Basically, something is lying to me. Either the Disk Utility is fucking with me, and /dev/sdb is really /dev/sda, or the system is ignoring /etc/fstab when it's booting and mounting the disks. The question then becomes:

Can I change /etc/fstab safely? In other words, can I ignore the fact that that the Disk Utility is telling me that /dev/sda1 is already mounted to /, when it's abundantly clear that /dev/sdb1 is mounted there? Can I simply mount /dev/sda1 to another location, ignoring this apparent confusion? Further, would changing /etc/fstab to jive with what the Disk Utility is telling me be a bad idea?
"There is a principle which is a bar against all information, which is proof against all arguments and which cannot fail to keep a man in everlasting ignorance--that principle is contempt prior to investigation." -Herbert Spencer

"Against stupidity the gods themselves contend in vain." - Schiller, Die Jungfrau von Orleans, III vi.
rapidsquirrel
Youngling
Posts: 80
Joined: 2008-09-12 11:18am

Re: On Linux and mounting hard drives

Post by rapidsquirrel »

Can you change fstab? Sure, that's easy, won't take effect until the next boot, but I'd be surprised if you really want to do that.

I'm guessing that that the drives have swapped drive letters, i.e. sdb has become sba, mainly because I don't see the new install being happy unless this is the case. Is it possible you swapped the drives when you disconnected the drive with 10.10 on it? Have you checked dmesg for info regarding the kernel seeing the drives?

I'd recommend just trying to mount sdb somewhere else, and seeing what is on it.
User avatar
Alferd Packer
Sith Marauder
Posts: 3706
Joined: 2002-07-19 09:22pm
Location: Slumgullion Pass
Contact:

Re: On Linux and mounting hard drives

Post by Alferd Packer »

Quick update:

After playing around with the command line, I discovered that the Disk Utility has labeled the drives correctly: /dev/sdb1 is my operating system, and /dev/sda1 is the old disk. After manually mounting it, I've copied over everything I needed.
you might want to edit that fstab line so / is the right sdb1. Make sure sdb1 is the drive you actually want though - it could have been renamed during the reinstall process.
Question: if this somehow breaks things, I could, most likely, resolve it by booting off a USB stick, right? Not that I think it will, of course. Also, you think there might be any potential harm in leaving things as is?
"There is a principle which is a bar against all information, which is proof against all arguments and which cannot fail to keep a man in everlasting ignorance--that principle is contempt prior to investigation." -Herbert Spencer

"Against stupidity the gods themselves contend in vain." - Schiller, Die Jungfrau von Orleans, III vi.
Post Reply