[wplug] dd

Brandon Kuczenski brandon at 301south.net
Tue Feb 15 12:48:27 EST 2005


On Tue, 15 Feb 2005, Jonathan S. Billings wrote:

>
> On Feb 15, 2005, at 12:38 AM, Brandon Kuczenski wrote:
>> 
>>  - boot into single-user mode with both drives installed
>>  - not mount the drives in question
>>  - not format or label the new, replacement drive
>>  - run 'dd id=/dev/hdb od=/dev/hdc -possibly -other -arguments'
>>  - switch the drives and reboot into happiness.
>> 
>>  (1) Does this seem like a proper and successful use of 'dd'?  And (2) is 
>> the answer to that question OS-dependent (neglecting the device names and 
>> arguments), or only POSIX dependent?
>
> This should work as long as you have it continue with error.   However, the 
> drives are made from two different manufacturers, the geometry will be 
> different and so the resulting new disk will probably look strange to any 
> partition editors, if you later try to change it.  Don't be surprised if you 
> see these errors.
>
> In your situation, I'd probably use 'fdisk' to create the partitions on the 
> new disk, use mkfs to create the filesystems, and dump and restore to copy 
> the contents of the filesystems to the new disk.  If anything, it'll probably 
> be faster, since dd copies every block on the disk, regardless of whether 
> there's any data allocated to that block.  Also, the dump/restore would not 
> bring over any bad filesystem problems.  You might lose data where the 
> filesystem was damaged, but you can be fairly certain that the problem won't 
> be carried over.

Thanks to all who replied.

Interesting.

I am thinking, I could do something like
  'dump -0f - /dev/hdbN | restore -rf - /dev/hdcN'

for each partition replacing 'N', and assuming hdc is partitioned and 
{mk|new}fs'ed and mounted?

That does seem better and more 'optimal,' though a little less 
'idiot-proof'.

-Brandon



More information about the wplug mailing list