5

I have a set of files on my webserver produced by duplicity software:

  • duplicity-full.20110315T085334Z.vol1.difftar.gz
  • duplicity-full.20110315T085334Z.vol2.difftar.gz
  • duplicity-full.20110315T085334Z.vol3.difftar.gz
  • etc... (50 files, total size about 1 Gb)

Backup has been made without encryption.

My current hoster haven't duplicity on his server and don't want to install it. How can I unpack these files using remote SSH access? Maybe there is some bash-script available to do that?

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Andrew
  • 321
  • 3
  • 5
  • 11

4 Answers4

8

In case anyone else comes across this (as I just have) there are some reasonably detailed (and mostly correct) steps over here.

Key details

The key point is to unpack all of the duplicity-full.*.difftar.gz files in the same place, so that you're left with just two snapshot/ and multivol_snapshot/ directories.

If your file is in snapshot/ then you're done. Otherwise find the directory in multivol_snapshot/ at the path where your file used to be: you need to join together all the files in this directory to recreate the original file. The files are numbered, and can be joined together using the cat command. Depending on how large the original was, there may be many parts.

Problem with original instructions

The directions linked above suggest using cat * > rescued-file. Unfortunately this simple approach fails if you have more than 9 parts. Since * expands in dictionary order, not numeric order, 10 would be listed before 2, and the file would be reconstructed in the wrong order.

Workaround

One simple approach is to remember that dictionary order does work when numbers are the same length, and that ? matches a single character. So if your largest file has three digits, you can manually enter:

cat ? ?? ??? > rescued-file

Add or remove ? patterns as necessary, depending on the largest file number.

Script

If you have a lot of files to recover and don't fancy typing that for all of them, you might prefer to use a script such as this. It lists the containing directory for every file, removes duplicates from the list, then goes to each directory and creates a content file from the fragments there. (spacer is just to make $1 work.)

find multivol_snapshot/ -type f -printf '%h\0' | \
  sort -uz | \
  xargs -0 -n 1 sh -c 'cd "$1" ; cat $(ls | sort -n) > content' spacer

Now you just have to add /content to the end of any filename you were looking for, and you should find it.

Limitations

This doesn't restore any of the original file permissions or ownership. It also doesn't deal with incremental backups, but then the linked instructions also hit a bit of a dead end on this point — they just suggest using rdiff 'to stitch the files together' and refer the reader to man rdiff.

BMitch
  • 5,189
  • 1
  • 21
  • 30
Paul Whittaker
  • 213
  • 2
  • 6
  • 1
    [this](http://sashikasuren.blogspot.in/2013/01/duplicity-backup-restore-process.html) links has a java program for the recovery. – totti Jun 25 '14 at 08:50
2

How about download the required archive and then make like this: duplicity scp://uid@other.host//usr/backup restored_dir (example from official site)

black-tux
  • 36
  • 1
  • It is possible but slow: 1 GB to download and then 4-5 GB to upload. Sure if there will be no other way to do this directly on server, I'll use this method. :( – Andrew Mar 21 '11 at 12:19
  • ok. Seems there is no other way except this – Andrew Mar 21 '11 at 13:48
0

You can try to unzip those archives, and copy needed files. I do not know how it backup files, but i think it copy files to the dir and gzip it (or tar.gz)

black-tux
  • 36
  • 1
  • Each .difftar.gz volume has 2 subfolders inside: "snapshot" and "multivol_snashot". Each file in "multivol_snapshot" folder represented as folders containing parts of that file (1, 2, 3 etc). I have no idea how to unpack them correctly – Andrew Mar 21 '11 at 11:36
0

In your case, I think, it's better to use backup software (or script) that can be simply extracted. You can see for backuppc, flaxbackup (I don't know will it work on your host or not, if it's vps (or vds) it will, but if it's just shared hosting it will not).

black-tux
  • 36
  • 1