disk partitioning and copying across machines:

In the past, I’ve used g4u to copy partitions on network, but the new Dell pcs have some kind of Pentium and ethernet that g4u does not recognize. So this presents a fruitful opportunity to learn.

Copy the mbr from /dev/hda into a file in working directory

dd if=/dev/hda of=backup-hda.mbr count=1 bs=512

Copy the partition setup of the extended partition:

sfdisk -d /dev/hda > backup-hda.sf

To restore the MBR

dd if=backup-hda.mbr of=/dev/hda

Restore the extended partitions:

sfdisk /dev/hda < backup-hda.sf Before compressing a partition, do this to write a 0 over every open spot so the compression algorithm will be most efficient. dd if=/dev/zero of=/TARGETPARTITION/0bits bs=20971520 # bs=20m Can use netcat to copy partitions over network. Mysterious, somewhat slow. In the new netcat, the procedure does not involve dd, so it is not clear how to speed this up with bs settings. http://www.cyberciti.biz/tips/howto-copy-compressed-drive-image-over-network.html On the TARGET machine, 129.237.61.XX, make sure port 12345 is unfirewalled. Then set netcat to grab the incoming on 12345 and divert it to disk /dev/sdb. Can also replace with particular partition /dev/sdb2: nc -l 12345 | bzip2 -d > /dev/sdb

After that, go to the SOURCE machine and compress the source disk /dev/sda and pipe it to through nc over to the other system:

bzip2 -c /dev/sda | nc 129.237.61.XX 12345

That does work, but not speedy.

I’ve been experimenting with partition image for the same job.

About pauljohn

Paul E. Johnson is a Professor of Political Science at the University of Kansas. He is an avid Linux User, an adequate system administrator and C programmer, and humility is one of his greatest strengths.
This entry was posted in Linux. Bookmark the permalink.