[plug] Migrate HDD on headless server
Cameron Patrick
cameron at patrick.wattle.id.au
Sat Jun 28 10:44:30 WST 2003
On Sat, Jun 28, 2003 at 10:23:46AM +0800, Craig Ringer wrote:
| I think that in your case, perhaps you should simply move the disks to a
| machine which isn't broken and do the migration there, then put the new
| disk back?
Well, he /could/ save the hardware swapping and do it on a running
system, though you'd want to kill off any unnecessary daemons (cron!)
and preferably make sure that it isn't going to be accessed by other
random machines over a network at the time.
SSH in, fdisk and mk{e2,reiser}fs the new drive, then do something like
the following (depending on what partitions):
# Mount the /new/ partitions
mount /dev/hdc3 /mnt
mount /dev/hdc1 /mnt/boot
mount /dev/hdc4 /mnt/home
# Repeat for each partition on the /old/ drive...
(cd / && tar clf - .) | (cd /mnt && tar xvpf -)
(cd /boot && tar clf - .) | (cd /mnt/boot && tar xvpf -)
(cd /home && tar clf - .) | (cd /mnt/home && tar xvpf -)
Then fiddle the fstab in /mnt (assuming the new partition layout is
different), and adjust /mnt/etc/lilo.conf to say something like:
disk=/dev/hdc # tell lilo that hdc will be the 1st hard drive
bios=0x80
install=/dev/hdc # tell lilo to install itself on hdc
(NB I've almost certainly got the syntax wrong here - although as it
happens I did more-or-less exactly this last night (!) but I don't have
lilo installed on the machine in front of me so can't check the manual.
In any case man lilo.conf is your friend here.)
Then install lilo on the new system like so: chroot /mnt /sbin/lilo
There's probably an equivalent for grub but I've never tried to install
it in a chroot system like that.
Unmount everything, shut it down, change over the discs and pray to the
deity of your choice! :)
Once you've got the new system up and running you'll want to change it
back to the original LILO config and re-run lilo to make sure it still
works...
Also doing this on a machine which has genuinely broken graphics
hardware sounds like asking for trouble if anything should go wrong.
HTH,
Cameron.
More information about the plug
mailing list