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


Regards,
/Benny


> On Fri, Nov 4, 2011 at 6:25 PM, Marc Smith <[email protected]> wrote:
>> dd if=/dev/wd0a of=root.img bs=32m [or compress it using: dd
>> if=/dev/wd0a bs=32m | gzip > root.img.gz]
>>
>> and
>>
>> dd if=root.img of=/dev/wd0a bs=32m [decompression: gzip -d -c
>> root.img.gz | dd of=/dev/wd0a bs=32m]
>>
>> And yes, you can ommit additional values.
>>
>> Dnia piD , 4 lis 2011, 17:43:28 Bambero pisze:
>>> Hello
>>>
>>> I want to copy my root partition to another with dd without ssh. Is
>>> this correct:
>>>
>>> 1. On first machine:
>>> dd if=/dev/rwd0a of=root.img bs=16b skip=1 conv=noerror
>>>
>>> 2. On second machine:
>>> dd if=root.img of=/dev/rwd0a bs=16b seek=1
>>>
>>> May/should I ommit seek, skip, conv, bs  parameters ?
>>>
>>> Regards,
>>> Bambero
> 

-- 
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