[plug] Changing hardware on desktop

Grahame Bowland grahame at azale.net
Thu Aug 1 04:56:48 WST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 31 Jul 2002 10:35 pm, Craig Ringer wrote:

[snip]

> If you leave the machine with two disks, make sure the old one is on the
> same controller position (ie hda probably - primary master) that it was
> before or you'll confuse the boot loader and the BIOS.
>
> If you copy everything across it will be ok but beware of doing this
> using the "cp" command as it will break symlinks, hang on named pipes,
> and all sorts of things like that. Using cp -aR will let it copy device
> files etc ok, but you'll still have to watch stuff like recursion. You
> can't "cp -aR / /mnt/newroot" obviously.
>
> I've probably made it sound more complex than it needs to be. The quick
> answer is: keep your old disk on the same controller position (eg
> primary master) and all will be well.

Ok, it's generally very simple to move over to a new harddisk. Here is an way 
to do it.

Old disk:
  /dev/hda1 mounted as '/' (root partition)
  /dev/hda2 is a swap partition
  /dev/hda3 mounted as '/usr' (usr partition)

1. Boot your system from the old hard disk, with the new hard disk as a  
   secondary.
2. Make sure that Linux is recognising the new disk; it should show up 
   in "dmesg"
3. Use "fdisk" or some other tool to create partitions on the new disk. Make 
   a partition for every partition on the old disk, of greater or equal size 
   to the old partition. Initialise the partitions, eg "mkswap" or "mke2fs".
   -> so now we have /dev/hdb1, /dev/hdb2, /dev/hdb3
   -> mke2fs /dev/hdb1
   -> mkswap /dev/hdb2
   -> mke2fs /dev/hdb3
4. For each partition that contains files:
   1. mount corresponding filesystem on '/mnt'
      -> mount /dev/hdb1 /mnt
   2. copy files over 
      -> cd / && find . -mount | cpio -pvm /mnt
   3. unmount the filesystem
      -> umount /mnt
   4. repeat for other partitions, eg.
      -> mount /dev/hdb2 /mnt; cd /usr && find . -mount | cpio -pvm /mnt;
         umount /mnt
5. Mount the new root filesystem on '/mnt'
   -> mount /dev/hdb1 /mnt
6. Chroot to the new filesystem
   -> cd /mnt; chroot .
7. Edit lilo.conf; make the boot= line boot=/dev/hdb
8. Run lilo
   -> lilo
9. Exit the chroot
   -> ^D
10. Make the new disk your primary master and reboot. Unplug the old disk to
    be safe.

These instructions will (obviously) vary depending on your actual partition 
table and devices; don't blame me if your computer spontaneously ignites.
This way at least you are not using 'cp', which will screw up symlinks and 
other trickier things.

- -- 
Grahame Bowland - <grahame at azale.net>
'All programmers are playwrights and all computers are lousy actors'
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9SE8XN7eIygKWKbARAqCMAJ9UXrkUaag8s8s0Xxg/u9m6Wcg44wCdHBeE
j4qITHWgs5ZPYy0LSmCn3sQ=
=mA3E
-----END PGP SIGNATURE-----




More information about the plug mailing list