You can dd a device to another device, a file to a device, or a device to a file. But it’s really all just file’s since character devices are just files too. You probably already know how to “double buffer” your dd’s by piping dd with an input to dd with an output, but you can make it a party with by inviting netcat and gzip! Aren’t pipes great? Just make sure you’re writing from a disk that’s the same size or larger than the target. Unless you don’t mind broken partitions that you’ll have to fix manually with a live dvd and parted or some other utility.
Use dd over a network connection to copy one file or disk to another, like magic! wow i like magic!
# nc -l 1234 | dd of=/dev/sda
# dd if=/dev/sda | nc rootninja.com 1234
You can reduce bandwidth by compressing the stream of data between both dd’s.
# nc -l 1234 | gzip –cdf | dd of=/dev/sda
# dd if=/dev/hda | gzip -cf | nc rootninja.com 1234
You don’t have to write directly to another device. You can use this method to store images on a remote machine. DIY backups?! zomglolbbq!!! kaboom!!!
netcat uses TCP by default, which is good, so if you get errors on the target (but it didn’t just fail completely), then it’s probably from dd. It either hiccuped reading or writing. However, to this very day, i’ve never had a…… i’m not going to say it, I’ll just jinx myself!
2:16 am
I really like your blog and i respect your work. I’ll be a frequent visitor.