Looking for a way to backup/mirror a drive by swapping

backupdd

I want to duplicate a drive.

I am unable to hook up both the old and new drive at the same time (the old powerbrick died; so I have one powerbrick to swap between two drives).

In years and years past, backup programs would read in as much as possible into memory, have you swap disks, and then output; repeat until finished.

Thinking about that, a script that used dd to read from the source, compress and store in a local file, and when the local drive is full (or the temp file is a given size), stop, let you change the disk, and then output.

It's … well, it would probably take me two weeks to write and debug a bash script for this. And that's assuming a fixed-sized to read and write — not using gzip to reduce the swaps.

The drive in question includes a time machine backup, so file copy is out of the question. And none of the file copy tools that I can think of will work to break it up into partial copies.

Has anyone run into this, and have a script for repeated DD's of partial copying to duplicate a drive in pieces?

Best Answer

My recommendation would be to do the dd over the network. I've used that method to back up laptop hard drives (much easier than pulling it out, or getting an external drive), and as long as you have a decently fast network, it's generally not TOO slow. It'll certainly be far more convenient than anything involving manual switching.

Omit the of= parameter to dd and it'll write the content to stdout; then pipe that into ssh user@othercomputer 'cat >disk.img' to push it over the network and save it.

Related Question