disk-cloning without pain

20. Dezember 2006, 22:33

network-based cloning with a cloning-server using grml, dd, sfdisk, tar, gzip and nc (for a grub-based installation)
  1. boot source from grml-cd
  2. copy your MBR from the source to the cloning-server, on the cloning-server:
    nc -vlp 30000 >mbr.img
  3. on the source:
    dd if=/dev/hda bs=512 count=1 | nc cloning-server 30000 -w 3
  4. copy a dump of your partition-table to the cloning-server, on the cloning-server:
    nc -vlp 30000 >fstab.img
  5. on the source:
    sfdisk -d /dev/hda | nc cloning-server 30000 -w 3
  6. copy your partitions (only files, not entire partitions) to the cloning-server, on the cloning-server for hda1:
    nc -vlp 30000 >hda1.tar.gz
    Do this with all partitions except swap
  7. mount your partitions and copy them to the cloning-server, on the source:
    mount /dev/hda1 /mnt
    cd /mnt
    tar -cvzf - . | nc cloning-server 30000 -w 3
    with all partitions except swap

  1. boot the target with grml-cd
  2. restore your MBR, on the target:
    nc -vlp 30000 | dd of=/dev/hda
  3. on the cloning-server:
    cat mbr.img | nc target 30000 -w 3
  4. restore your partition-table, on the target:
    nc -vlp 30000 | sfdisk /dev/hda
  5. on the cloning-server:
    cat fstab.img | nc target 30000 -w 3
  6. Make the appropriate filesystems on the target: use mkfs/mkswap on target partitions
  7. restore your files for each partition, on the target:
    mount /dev/hda1 /mnt/hda1
    nc -vlp 30000 | tar -xvzf -
  8. on the cloning-server:
    cat hda1.tar.gz|nc target 30000 -w 3
    with all partitions except swap
  9. re-install grub (grub files here are on hda1/boot/grub/, change to your needs), on the target :
    if needed, (re)mount root-partition: mount /dev/hda1 /mnt/hda1
    grub-install --root-directory=/mnt/hda1 hd0
  10. reboot target :-)

Kategorie:

---
|
---