On Sun, 6 Nov 2011, Benny Lofgren wrote:

On 2011-11-06 18.00, Bambero wrote:
Thanks, but without skip=1 dd will copy partition table and mbr too
(first block 521b).
So it may damage my partition table on second machine. I'm I wrong ?

No, you will not copy the partition table with your command, since
you are using wd0a. That partition starts after the boot sector(s)
and partition table, so what you're in fact doing is skipping the
first blocks of the file system that is on partition a of wd0. Which
you don't want to do. (If you had used wd0c on the other hand, you
would have gotten the disk partition metadata as well. But you don't
want that either.)

By the way, seek= and skip= gets multiplied by whatever block size you
set (in your case, 16b == 16 x 512 == 8 Kb) so you're not even skipping
the first sector which you think but the first 16 sectors.

Also, don't use the block device when doing this, use the raw (character)
device.

And, and I hope this goes without saying, DON'T DO THIS ON A MOUNTED DEVICE.

So, skip the skip.   Just do the following:

On the source machine:

Boot from something other than your root disk, or boot into single user
mode and remount root read-only. Then:

dd if=/dev/rwd0a of=/tmp/root.img bs=16m

On the target machine, booted from some install media:

dd if=/your/tmp/drive/root.img of=/dev/rwd0a bs=16m

Benny, with this you will overwrite the disklabel of whole target disk, as the disklabel in a typical case indeed resides at the beginning of the wd0a. See disklabel(5).

Regards,
David

Reply via email to