[H-GEN] Cloning Linux System

Mark Suter suter at zwitterion.humbug.org.au
Tue Jun 7 06:34:24 EDT 2005


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

Folks,

On a more immediately practical note, here are some details on
the steps I took this evening to move a Debian GNU/Linux system
from one hard drive to another within the same case.

    ## Shutdown the system
    shutdown -h +15 Moving to a new disk...

    ## Add the new hard disk (/dev/hdd)

    ## Boot as normal

    ## Ready the new disk
    echo -e "0,5120\n,2048,S\n,10240\n;" | sfdisk -uM /dev/hdd
    mkfs -t ext3 -L root -O filetype /dev/hdd1
    mkswap /dev/hdd2
    mkfs -t ext3 -L var  -O filetype /dev/hdd3
    mkfs -t ext3 -L home -O filetype /dev/hdd4

    ## Mount for the copy
    mkdir /new
    mount /dev/hdd1 /new
    mkdir /new/var
    mkdir /new/home
    mount /dev/hdd3 /new/var
    mount /dev/hdd4 /new/home

    ## Quiesce the system
    for daemon in apache cron squid sendmail samba mysql ; do /etc/init.d/$daemon stop ; done

    ## Do the copy
    cd / ; find . var home -xdev -print0 | cpio -0pmd /new

    ## Make it bootable
    sync ; sync ; sync
    chroot /new /sbin/grub --batch --device-map=/dev/null <<EOF
    device (hd0) /dev/hdd
    root (hd0,0)
    setup (hd0)
    quit
    EOF

    ## Umount
    umount /new/var
    umount /new/home
    umount /new

    ## Shutdown
    shutdown -h now

    ## Remove /dev/hda

    ## Move /dev/hdd to /dev/hda

    ## Boot as normal

Yours sincerely,

- -- Mark John Suter  | I know that you  believe  you understand
suter at humbug.org.au | what you think I said, but I am not sure
gpg key id 2C71D63D | you realise that what you  heard  is not
mobile 0411 262 316 | what I meant.        Robert J. McCloskey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Check Keyservers or http://zwitterion.org/keys/

iD8DBQFCpXgvRYso2ixx1j0RAkoKAJwPCttoirzr/Q+q35jsUPh4tHhycACfUEc+
funH9+K8SDm6tQ2FQntdyo4=
=2Sv3
-----END PGP SIGNATURE-----




More information about the General mailing list