How to mirror a harddisk for backup purpose

Donald Becker becker at scyld.com
Fri Jun 22 09:14:39 EDT 2001


> On Fri, 22 Jun 2001, Kwan Wing Keung wrote:
> > I want to backup an entire LINUX harddisk to another identical harddisk.
> > Some colleagues suggested that I may consider the "dd" command.

On Fri, 22 Jun 2001 alvin at Mail.Linux-Consulting.com wrote:
> i would use tar to copy disks onto antoher disk...

The 'tar' program works for filesystems.
It is considerably different semantically than 'dd'.
  - If the filesystem is full, it takes much longer.
  - If the filesystem is mostly empty, it can be dramatically faster.
  - File "holes" are filled with zeros, instead of taking up no blocks.
  - Files are linearized/defragmented when copied to a freshly
    created filesystem.

> # copy hda  onto hdb...
> dd if=/dev/hda  of=/dev/hdb bs=1024

This will copy the entire disk contents, including the partition table.
For most partition table types, this will only work if the disks are the
same size and C/H/S geometry.  Since you are doing a backup to an
identical disk, this approach is suitable 

More commonly, you want to copy partition-by-partition instead.
   dd if=/dev/hda1 of=/dev/hdb1
   dd if=/dev/hda2 of=/dev/hdb2
   ...
As long as the new partition is the same size, the filesystem will
remain intact.

This does require you to first put a partition table on the target disk.

Note that 'dd' is pretty much the same as
   cp /dev/hda1 /dev/hdb1
The reason old timers recommend 'dd' is a long-forgotten semantic bug in
old UNIX systems that could be worked around by reading only whole
blocks from raw devices.  This has now turned into superstition.

> BUT..BUT...dd is bad ...
> 	- it copies bad block info fron disk-a onto disk-b
> 	- it does NOT know that disk-b has bad sectors where it was
> 	  good on disk-a

These don't apply for any disk made in the past 10 years.  All modern
disks remap bad blocks without the OS knowing about the problem.
You do lose information about freshly-bad blocks, but that's not a
problem when (bring this back to Beowulf) cloning disks and filesystems.

> 	- it copies all the empty unused space onto the 2nd disk
> 	  unless you tell it NOT to copy all of the partition
> 	  in which case you are assuming that you know where all
> 	  the bits are for a given file/inode tree

This is a big issue with 80GB disks.
We quit doing whole-disk cloning in 1995 when we went from 540MB disks to
2GB disks.
We gave up direct partition copying 1996 when we went from 16 to over 50
nodes.

Donald Becker				becker at scyld.com
Scyld Computing Corporation		http://www.scyld.com
410 Severn Ave. Suite 210		Second Generation Beowulf Clusters
Annapolis MD 21403			410-990-9993




_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf



More information about the Beowulf mailing list