Backup with dd?

Garance A Drosihn drosih at rpi.edu
Mon Jan 3 11:05:10 PST 2005


At 11:57 AM -0600 1/3/05, Eric F Crist wrote:
>Hello all,
>
>I've decided to try doing a complete system backup, attempting a
>bit-for-bit copy.  A friend told me to try the following:
>
># dd if=/dev/ad4 of=/dev/ad6
>
>Both drives are identical SATA150.  Is this the best way?

While that will probably work, it is also somewhat risky to make
a direct copy of a disk that you are actively using.  You can end
up with a copy that has inconsistencies, because of changes that
happen on the source disk during the time it takes to do a copy.
And if you are copying a huge disk, it *will* take a significant
amount of time to perform that copy.  By "inconsistent", I mean
that when you boot up on the copy, the initial 'fsck' will fail
because of inconsistencies on the disk.

I have done 'dd' copies like this.  I have seen fsck failures...

>I'm hope to be able to do a daily/weekly backup this way, and if
>my primary drive fails, switch the cables and just reboot.

You would be better to do the copies on a per-partition basis, and
first create a UFS snapshot of each partition, and then use the
snapshot as the source for your copy.  I actually use a 'dump -L'
command, combined with 'restore'.  The -L option causes dump to
automatically create the snapshot for the partition you specified.
It uses the snapshot for the copy, and then destroys the snapshot
when the copy has finished.

This assumes you're running 5.3-stable or 6.x-current.  I am not
sure how well snapshots would work on 4.x-stable.

-- 
Garance Alistair Drosehn            =   gad at gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-questions mailing list