network-based cloning with a cloning-server using grml, dd, sfdisk, tar, gzip and nc (for a grub-based installation)
- boot source from grml-cd
- copy your MBR from the source to the cloning-server, on the cloning-server:
nc -vlp 30000 >mbr.img
- on the source:
dd if=/dev/hda bs=512 count=1 | nc cloning-server 30000 -w 3
- copy a dump of your partition-table to the cloning-server, on the cloning-server:
nc -vlp 30000 >fstab.img
- on the source:
sfdisk -d /dev/hda | nc cloning-server 30000 -w 3
- 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
- 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 :-)