[ltp] Cloning a hard disk?

Eben King linux-thinkpad@linux-thinkpad.org
Thu, 18 Aug 2005 11:02:01 -0400 (EDT)


On Thu, 18 Aug 2005, Richard Neill wrote:

> Paul Kaplan wrote:
> 
> >>So I'm looking for a Windows software that will let me clone the IBM hard
> >>disk, entirely, with all its partitions and data, onto the Samsung hard
> >>disk. 
> 
> Boot the laptop with knoppix. Then, something like:
> 
> dd if=/dev/hda1 | ssh root@des-machine -e "cat /dev/hdX1"

In ssh (unlike in *term), "-e"=escape character; no option is needed for the
command to run.  Use "-e none" to ensure an 8-bit-clean path between the two
machines.

> This assumes you have the samsung disk mounted in another machine.

Which you can ssh into as root.  You can ssh as Joe User and then su, but
it's more complicated.  So:

dd if=/dev/hda1 | ssh root@des-machine -e none cat \> /dev/hdX1

or maybe

ssh root@des-machine -e none cat \> /dev/hdX1 < /dev/hda1

(not sure which is better)

Somebody recently posted a method to use nc instead of ssh, if you're sure 
your network is secure (might have been on a different ML).  Here: 
http://www.laportestyle.org/tutorials/ghostinthemachine.php

> Notes:
> 
> 1)check my syntax - I am not certain it's correct

Ditto.

> 2)Remember to test the new image!

If you copy partitions, it won't copy the boot block(s).

> 3)Think carefully about partitions. If you copy them over partition at a 
> time, you'll need to partition the new disk first. If you copy over the 
> entire disk (dev/hda rather than dev/hda1), then what happens if the two 
> disks are not exactly the same size?

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
                  "God does not play dice" -- Einstein
          "Not only does God play dice, he sometimes throws
          them where they can't be seen." -- Stephen Hawking