[Sussex] Really Dumb dd question

Steve Dobson SDobson at manh.com
Thu Jan 9 10:01:01 UTC 2003


Nik/John

On 08 January 2003 at 18:38 John Crowhurst wrote:
> Nik wrote:
> > okay, so heres a question.
> >
> > lets say at 2am in the morning when all the boring services 
> and users
> > are not being utilised and the back is done we do the following
> >
> >
> > dd if=/dev/hda of=/dev/hdb
> 
> What will happen would be a raw copy of disk a to disk b (thats
> everything, partitions, empty space and all) It will do a complete
> diskcopy, and disk b will look exactly like disk a.
>
> If you only intend to make a backup of a filesystem, use 
> cpio, cp or tar.
> 
> It would also be better if both drives were not mounted, in case data
> changes on the disk and you end up with a corrupted backup.

No, it is necessary that disk a is not mountted read/write.  It can
be mountted read only and then all is safe.
 
> > where /dev/hda1 is the active file system and /dev/hdb is 
> never mounted.
> > Im i mad or sane ?
> 
> Mad!

Agreed.  If's Nik's goal here is to make a backup as all this will do will
create a copy on the same machine.  If backup is the goal then the second
disk needs to be on a seperate machine in another building far, far away.

In which case the command is (you better have a secure network for this
on):
  # dd if=/dev/hda if=- | rsh backup dd if=- of=/dev/hdb

But is the power of Unix and the way dd works it not a mad think to do.
I would recommend that you set the block size to a multiple of 512, it'll
run faster then.

<snip>

Steve




More information about the Sussex mailing list