52

I use the default backup utility of ubuntu (deja-dup) in the settings panel. Today I delete by error one directory. I tried to restore it but I did not succeed. Must I restore all my backup if I only need one single directory or file ?

Thanks.

Ger
  • 763

3 Answers3

75

Of course you can do that. From the gnome DejaDup Help wiki (oh and where it says file you can also read directory)

Restore a Lost File with Déjà Dup (wiki link)

  • Open the file browser (Nautilus)
  • Browse to the real folder containing the file you lost (not via any symlink)
  • Right click in the folder, between files ▸ Restore Missing Files… (this might not be available if you view your files as a list, choose grid of icons on the top of nautilus window)
  • When the Restore dialog appears, it will scan for files that are in the backup but no longer in the folder
  • When you see the file you want to restore appear, select it and click Forward
  • Review your selections and click Restore

Restore a Previous Version of a File with Déjà Dup (wiki link)

  • Open the file browser (Nautilus)
  • Go to the real folder containing the file you want to revert (not via any symlink)
  • Right click on the file you want to revert
  • Choose Revert to Previous Version…
  • Up comes the Déjà Dup dialog. Choose the date from which to restore. Click Forward
  • Review your selections and click Restore. Note: this will overwrite your current version of the file
  • Done!

Note that for Ubuntu you'll need the ubuntuone-client package installed in order for the menu entries to appear in Nautilus, even if you're not using Ubuntu One.
Also note that Mate's version of Nautilus, Caja, does not support restoring files.

Pro Tips

  • You can select multiple files at once before right clicking.
  • You can revert files on the command line:

    deja-dup --restore FILE1 FILE2
    
wranvaud
  • 1,805
Rinzwind
  • 299,756
  • Thanks, it works perfectly. Can you give the adress of the wiki please. – Ger Aug 28 '12 at 11:40
  • 1
    It is already there: click the red links in the headers ;) – Rinzwind Aug 28 '12 at 12:28
  • 1
    it might be needed to install deja-dup-nautilus before you see the restore file menu. – Jens Timmerman Jan 19 '16 at 12:49
  • 2
    Important note: for this to work you have to browse to the real location, not using short-cuts i.e. symlinks. @Rinzwind, maybe you can add this to the answer. – rosch Sep 14 '16 at 07:56
  • @JensTimmerman this package is no longer available in Ubuntu and so this menu item won't appear – hellocatfood Apr 14 '17 at 17:01
  • The dialog to restore missing files for closes both in nautilus and as well in caja – tokam Feb 21 '18 at 11:52
  • ubuntuone-client is not available for my computer running Ubuntu 16.04 but I still have these menu entries. – geras Aug 20 '18 at 08:18
  • When I "Restore a Previous Version of a Folder" does the current folder get deleted or are the two versions merged? From my experience it seems like they are merged with priority given to the previous version. – geras Aug 20 '18 at 08:23
  • Delete would remove data so no. It will be merged (and based on rsync principle based on last timestamp). – Rinzwind Aug 20 '18 at 08:25
20

The above answer did not work for me as the drive that had originally been backed up had been removed. I share the procedure I followed below:

  • 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 archive - You need to indicate the full path to the folder containing your backup.

  • Create folder for restore:

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 commands will be different for an encrypted backup. Check reference below.

Duplicity Reference

0

Caja user here, (Mate on 16.04.3). Problems with these solutions for me, FWIW.

"Backup" a.k.a. "deja dup" (note to developers: standardizing a name is really helpful when a newbie has to go looking for answers) won't allow me to do anything other than a full extraction of my whole backup to a location of my choosing. I just want one little directory for a malfunctioning VM...

  1. Used Nautilus. However, it doesn't have access to the directory I need (VBox. Me: "huh?"), so no restore function via GUI for me.

  2. deja-dup --restore FILE1 FILE2 doesn't work. It complains:

    ** (deja-dup:3343): CRITICAL **: deja_dup_config_location_add_volume_full: assertion 'uuid != NULL' failed

Of course, I'm assuming that FILE1 is the backup and FILE2 the restoration target. If not, I goofed.

Regardless, it just launched the GUI to deja-dup - that's a no go.

  1. Several attempts of Wilson Canda's method, thusly

$ duplicity restore --no-encryption file:///media/b/be5f7aad-aa52-47ea-8e64-4352111f66af/home/b/'VirtualBox VMs'/'Green Machine' 'VirtualBox VMs'/'Green Machine'

Local and Remote metadata are synchronised, no sync needed.
Last full backup date: none
Traceback (innermost last):
  File "/usr/bin/duplicity", line 1559, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1545, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1394, in main
    do_backup(action)
  File "/usr/bin/duplicity", line 1473, in do_backup
    restore(col_stats)
  File "/usr/bin/duplicity", line 729, in restore
    restore_get_patched_rop_iter(col_stats)):
  File "/usr/bin/duplicity", line 751, in restore_get_patched_rop_iter
    backup_chain = col_stats.get_backup_chain_at_time(time)
  File "/usr/lib/python2.7/dist-packages/duplicity/collections.py", line 984, in get_backup_chain_at_time
    raise CollectionsError("No backup chains found")
 CollectionsError: No backup chains found

A search engine of your choice will reveal others have this problem too over the years.

My work-around: "restore" everything to a 'holding folder' on my external drive via the GUI, manually go in and grab the directory I want, then zero-fill that folder.

  • When nautilus does not access the folders you need to work with, you can launch it from a command line (Terminal) with "sudo nautilus" . Of course, be cautious - this gives you access to internal system files, and the power to ruin everything! – ElHombre55 Feb 17 '19 at 19:16