Like many here, I experienced problems when restoring from larger splitted images. I used "--compress 1 --volume=4000" with backup and could not get the pieces back together with restore.
Neither "cat"ing nor "zcat"ing the files into partimage would help, so I dug the net for an answer. I found that Steven Shiau who uses partimage with his Clonezilla system ran into similar problems and found a solution. Sadly, his solution did not work with splits of 4GB due to limitations in the gzip file standard, and the workaround would be quite timeconsuming for everydays usage (it involves a "zcat (file) | wc -c" to determine the file size!).
After studying his partimage_stdin source, I found a way faster and more elegant method of dealing with this problem:
- Code: Select all
# this bash-code expects the backup files as $BACKUPSET.000,
# $BACKUPSET.001, etc. Modify to match your environment.
toskip=0
{
for partfile in $BACKUPSET.*; do
zcat $pertfile | dd skip=$toskip 2>/dev/null
toskip=1
done;
} | partimage $RESTORE_OPTS restore $DEVICE stdin
Basically, all files of the set are uncompressed with zcat, but only the first is passed unaltered, all the later files get the first 512 bytes (1 block for dd - the partimage header) removed. With the help of {} grouping all output together, this is then passed into partimage.
As this method uses zcat, it only applies to backup sets generated with "--compress 1". I don't know if the approach would work with bzcat on a "--compress 2" image.
Warning: You use this code snippet at your own risk. Don't blame me if you burn soemething down by running it...
And: A big, big THANK YOU to Steven Shiau, who originally found the problem and provided the source with the answer.
Yours, Christian Treczoks
