On 2011-11-06 21.42, David Vasek wrote:
> 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.)
>>
[...]
> 
> 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).

Ah, you are absolutely correct, thanks. Please ignore my previous advice!

(Except the part about seek= and skip= not operating on 512 byte block
sizes but on the block size set by bs=/ibs=/obs=, that one will bite
anyone not paying attention to detail.)

Sorry for spreading FUD. (Although I can't really seem to find this out
from just reading disklabel(5) (I did check prior to my last comment), but
then again my brain's English language center might very well be somewhat
deficient...)

The best bet is probably to either go the dump/restore route like someone
suggested or simply save the target disk's label to file using something
like "disklabel wd1 >/tmp/disklabel.wd1" and then restoring it after dd
with "disklabel -R wd1 /tmp/disklabel.wd1" (since the in-core copy of the
original disk label will keep the working layout, there is no risk involved
with temporarily overwriting the label as long as it is restored prior to
the new disk's partitions being used).


Regards,
/Benny

-- 
internetlabbet.se     / work:   +46 8 551 124 80      / "Words must
Benny Lofgren        /  mobile: +46 70 718 11 90     /   be weighed,
                    /   fax:    +46 8 551 124 89    /    not counted."
                   /    email:  benny -at- internetlabbet.se

Reply via email to