Break up a dd image into multiple files
A simple solution might be to just use "/usr/bin/split". It just breaks files up into pieces. You can use "-" as the input file name to read from standard input. The nice thing about split is that it is simple, it doesn't affect the toolchain in any real way and you can "join" the files by just using "cat" to glob them back together (or pipe them to another app).
You probably want to consider using tar
, as KPWINC says, but to answer your question directly, you want to use dd
's "skip" option.
If your first command, as stated, is:
sudo dd if=/dev/sdf1 bs=4096 count=150GB | gzip > img1.gz
Then your second would be:
sudo dd if=/dev/sdf1 bs=4096 skip=150GB count=40GB | gzip > img2.gz
and third:
sudo dd if=/dev/sdf1 bs=4096 skip=190GB count=120GB | gzip > img3.gz
That said, I'm not sure that the "GB" suffix does what you're intending. I think it just does raw math on the root number it follows, not figure out how to get that many gigabytes from the block size you've given. I would do something like this:
dd if=/dev/sdf1 bs=`expr 10 * 1024 * 1024` count=`expr 15 * 1024 * 1024 * 1024`
just to be sure of the math.
Oh, and make sure that your device isn't changing underneath you as you copy it. That would be bad.
It is my command line:
dd if=/dev/sda bs=4M | gzip -c | split -b 2G - /mnt/backup_sda.img.gz
It will create 2GB files in this fashion:
backup_sda.img.gz.aa
backup_sda.img.gz.ab
backup_sda.img.gz.ac
Restore:
cat /mnt/UDISK1T/backup_sda.img.gz.* | gzip -dc | dd of=/dev/sda bs=4M
Hope it helps.