Message Board -  Archive

[ Login ] [ Create Account ]
[ Board List ] [ View Board ] [ Post Reply ]
  Author  Subject: Re: changing hard-drives

Posted on 07-21-2002 07:48 p.m. ET  reply

Original Poster: Mark Krentel

> Is it possible to take a linux hard-drive Master out of one tower and still
> have it work as a slave in another tower by just changing the pins to make
> it a slave hard-drive?
> Or do I have to install it as a slave changing the pins then re-install
> linux afterwards?

You shouldn't need to reinstall, but there are a couple of things that
need to be done. Linux doesn't care what disk it's on, except that
when you move the disk, the disk device names change. For example,
maybe /dev/hda becomes /dev/hdb. You'll need to change this in
/etc/fstab and /etc/lilo.conf, but that's probably about it. Most
everything else will refer to a file system path, such as /usr, and
not care what device /usr actually is.

Lilo is the tricky part because of a chicken and egg problem. If you
had a running system, you could edit lilo.conf, rerun lilo, reboot and
then you'd have a running system. But it won't work to edit lilo.conf
and run lilo on the old system because the disk will have the wrong
device name there too.

Try this sequence. Shut down and move the disk to the new machine.
Boot the new machine with the install CD in rescue mode and get to a
shell where you're root. The emergency boot floppy that you made
during the original install probably won't work here because the disk
is not on the same device.

Pick an unused mount point and manually mount the old / there. /mnt
is probably being used, so let's just make a new one with "mkdir /new"
and "mount /dev/hdb1 /new" (your device may be different). Edit fstab
(now /new/etc/fstab) and lilo.conf for the new values. Hopefully vi
or some simple editor is available on your rescue disk.

Now the tricky part. It probably won't work to just run lilo yet
because the paths in lilo.conf are wrong (the partition is on /new,
not /). Run "chroot /new". If this works, then /new is now / and the
paths are right. Now run lilo (with the device names for the new
machine). Exit the chroot shell with "exit", unmount /new, reboot and
see if it works.

If the chroot doesn't work, try symlinking the paths in lilo.conf.
Probably all you need is /boot. In the rescue shell, if there is a
/boot, mv it to another name and link "ln -s /new/boot /boot" and then
run lilo. The key in all of this is to have something running that
looks enough like the new layout so that when you run lilo, everything
goes into the right place.

And before you do any of this, you first have to decide what boot
manager you want on the new machine. I'm guessing the old machine was
Linux only with LILO on the MBR and the new machine is dual-boot. You
could put LILO in the MBR on the new machine, but maybe there's
already a boot manager there. Anyway, read "man lilo.conf" and decide
where you want to put LILO and edit lilo.conf accordingly.

When (if) it all works, boot Linux, check lilo.conf and run lilo one
last time and reboot to make sure everything is clean with lilo.

And one other potential pitfall. The disk's geometry on the old and
new machines must be identical or else the sectors won't match and you
really will need to reinstall. Many old BIOSes don't do LBA on the
2nd controller and that might not allow the same geometry. Check the
old geometry with "fdisk -l /dev/hda" and make sure it matches the new

And let me know if it works. I haven't tried the chroot thing. I've
done something similar by symlinking /boot as above, but chroot is
really a better solution. I'm just very curious if there's something
I'm overlooking.

You might want to practice with rescue mode on the old machine first.
Make sure that the commands you'll need (mount, vi, chroot, mkdir) are
available in rescue mode. And the CD for rescue mode doesn't have to
be same one that you installed with. It just needs to be Linux with a
few of the right tools. Slackware has a good rescue mode, many other
distributions don't.


< Previous 1 Next >

Site Contents