[sclug] Moving root filesystem from one drive to another

James Wyper jrwyper at yahoo.co.uk
Wed Aug 2 12:41:32 UTC 2006

Hello everyone,

My Linux server has two disks (and no room for any more).  hda is an
old 3.2GB drive, hdb is a more recent 80GB one.  The PC has Mandriva
Linux 10.1 installed, with / on hda, and /usr, /home, and swap on
separate partitions on hdb.

I want to put a bigger disk in the machine to replace the 3.2GB one,
and at the same time switch to a clean kubuntu install.  But because
this machine holds the family email and acts as firewall and router for
the whole house, I want to ensure that this change minimises disruption
/ downtime and allows me to quickly revert to Mandriva should I need

Here's what I plan to do - could you let me know if I've missed
anything or if you can suggest shortcuts:

1.  Backup /home and /usr, just in case.

2.  Swap IDE cables so the old hda becomes hdb (and vice versa)

3.  Boot Knoppix.  Use parted and/or fdisk to create a new 4GB primary
partition on (the new) hda - let's call this hda4.

4.  Copy the contents of hdb (the old root filesystem) to hda4 apart
from /tmp, /proc and /dev - is it best to use cp -r to do this?

5.  Edit lilo.conf and /etc/fstab on hda4 to change all references to
hdb* to hda*, and hda1 to hda4.  Run lilo to install the MBR on hda.

6.  At this point hdb (the old hda) should be redundant.

7.  Reboot and check system comes up OK.  If not then either attempt to
fix, or swap the IDE cables back again and system should revert to how
it was when I started.

8.  Assuming a successful boot, shut down, remove the 3.2GB disk, put
the new one in (as hdb) and install Kubuntu on it, leaving hda alone
until I'm satisfied that all the things my Mandriva installation did
(e.g. imap / smb serving, traffic shaping) are correctly configured
under Kubuntu.  This will probably take several evenings, but at least
I can reboot into Mandriva when I'm not working on the PC and have it
continue to do what it's supposed to.

Thanks in advance for any comments,

All New Yahoo! Mail ? Tired of Vi at gr@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html

More information about the Sclug mailing list