← Duplicity: Selective backup restoring
A couple of days ago, my laptop’s second HD (500GB WD) went rogue (once again). Besides the usual file corruption issues while opening the files I stored on it, it started compromising my boot (couldn’t boot at all while it was connected - running Ubuntu 13.04). Luckily, I’ve got a 32GB SSD on my motherboard and that is set as the boot partition so I was able to just remove the HD and start up the machine. The bigger problem was that now I was left “fileless” - all my work was on the second drive. I had a backup (on an external 3TB drive) but it was a full system backup - hundreds of GBs in size, which meant that I couldn’t restore it using the “regular” settings, since I was left with only a 32GB SSD on the machine. It occurred to me to restore the files to a location on the backup drive itself - but that always failed miserably, hanging and eventually crashing my system. The only option I could think of was to selectively restore the files: but I only knew how to do that through the Nautilus GUI: by navigating to the original folder and selecting “Restore Previous Version” of the file. Remember, I don’t have the original folder any more because the whole drive was gone. After some googling, I managed to formulate a general solution for that.
- In a terminal, type:
duplicity list-current-files –no-encryption file:///[path_to_backup_folder] > /home/[your_username]/list.txt
Be aware of the format “file:///…” in which duplicity expects to receive path to the archive - You need to indicate the full path to the folder containing your backup.
- Create folder for the restored files:
mkdir [PATH AND FILENAME FOR RESTORED FILE]
- Find the file/folder you wish to restore in the ‘list.txt’ file we created earlier (in home folder). Copy just the filename and path to file, not the date. Execute the following:
duplicity restore –no-encryption –file-to-restore [PASTE RESULTS FROM PREVIOUS STEP] file:///[LOCATION OF BACKUP] [PATH AND FILENAME FOR RESTORED FILE]
Please note that the procedure will be slightly different for an encrypted backup. Check the reference below for extra info.