Page 1 of 1

I fixed my restore problems!

Posted: Thu Nov 03, 2005 1:22 pm
by treczoks
Hi, all.

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

Re: I fixed my restore problems!

Posted: Sat Nov 05, 2005 1:51 am
by steven
Excellent! This is really much more elegant! Thanks for sharing that with us.

Posted: Wed Jan 11, 2006 10:10 pm
by Florian
Thanks a lot for this script. I'm in process of restoring a 40GB disk split in 2G files.

By the way, please note a typo: in the zcat command, the variable should be

Code: Select all

$partfile
and not

Code: Select all

$pertfile
.

Florian.

Problem with this step

Posted: Tue Sep 02, 2008 5:49 pm
by Gleison
I just made exactly as is written above, but an error message is occurring... It is recognizing the stdin as a place from where the partimage will restore the files.. It is showing that the partimage can't find stdin.000!! =(
Could anyone help me to identify this issue? I will be thanked a lot!!!

Thanks and Regards
Gleison Ziviani

Posted: Tue Feb 01, 2011 3:13 pm
by TiaTrevarthen
I'm going to join twelve files on 2GB each and I hope your method helps me with that !

Re: Problem with this step

Posted: Wed Feb 29, 2012 4:44 pm
by Lcstyle
Gleison wrote:I just made exactly as is written above, but an error message is occurring... It is recognizing the stdin as a place from where the partimage will restore the files.. It is showing that the partimage can't find stdin.000!! =(
Could anyone help me to identify this issue? I will be thanked a lot!!!

Thanks and Regards
Gleison Ziviani
Your problem is that you are not getting the correct syntax:

try
wget -q -O - ftp://whatever

(research "redirect wget output to stdout" for more information).