jensheidrich.de
  • Home
  • Kategorien
  • Tags
  • Archiv
  • Wunschliste

disk-cloning without pain

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
  1. on the source:
dd if=/dev/hda bs=512 count=1 | nc cloning-server 30000 -w 3
  1. copy a dump of your partition-table to the cloning-server, on the cloning-server:
nc -vlp 30000 >fstab.img
  1. on the source:
sfdisk -d /dev/hda | nc cloning-server 30000 -w 3
  1. 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
  1. mount your partitions and copy them to the cloning-server, on the source:
    mount /dev/hda1 /mntcd /mnttar -cvzf - . | nc cloning-server 30000 -w 3

with all partitions except swap

boot the target with grml-cd

restore your MBR, on the target:

nc -vlp 30000 | dd of=/dev/hda

on the cloning-server:

cat mbr.img | nc target 30000 -w 3

restore your partition-table, on the target:

nc -vlp 30000 | sfdisk /dev/hda

on the cloning-server:

cat fstab.img | nc target 30000 -w 3

Make the appropriate filesystems on the target: use mkfs/mkswap on target partitions

restore your files for each partition, on the target:

mount /dev/hda1 /mnt/hda1nc -vlp 30000 | tar -xvzf -

on the cloning-server:

cat hda1.tar.gz|nc target 30000 -w 3

with all partitions except swap

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/hda1grub-install --root-directory=/mnt/hda1 hd0

reboot target :-)

Share on: Twitter ❄ Facebook ❄ E-Mail

  • « away
  • Lez Zeppelin »

Datum

20.12.2006

Kategorie

Hack

Tags

  • linux 14
  • jensheidrich.de - parts of a memory dump
  • Impressum Datenschutz
  • Powered by Pelican. Theme: Elegant by Talha Mansoor