HOWTO Restore files backed up by d2dbackup ========================================== Single files ------------ One of the great features of d2dbackup is that you are not required to use an arcane restore program. To see all the backup versions of a file, use ls with wildcards. Suppose you want to look at the file /home/myuser/mydata stored on backup disks /bkup1 /bkup2 /bkup3. You would use the following command: ls -t /bkup*/home/myuser/mydata\;* Then copy the one you want in order to restore it. The -t flag to ls will list the files in order of modification time. Note that ; is a shell metacharacter, so it has to be escaped, both in the ls command an in a later cp command. Directories ----------- To recursively restore a directory, you have to find all the versions of each file, choose the last version, and copy it. Sadly there is no simple way to do that with a shell command, so we reluctantly included a --restore option to d2dbackup. To restore a directory, run d2dbackup as normal with the --restore option. d2dbackup --restore /home/myuser/mystuff If the backups were done using any src2backup mappings, for instance in a filesystem-specific configuration file, make sure that those are in effect for the restore too. Otherwise d2dbackup will be unable to find the backup files. This will replace the files in their original locations. If you need to preserve what is currently in that directory, either move the current contents somewhere else temporarily, then merge them manually, or make use of the --clobber option. Without --clobber, a restored file will never overwrite one already on the source filesystem; with --clobber, it will. Normally, --restore does not restore deleted files. This is so that you are restoring a directory into its last known state. If you want deleted files also, use --rdeleted in conjunction with --restore. If the backups were done from a snapshot, obviously you cannot restore back to the original location. You will have to carefully craft a mapsrc2backup statement or argument to achieve the desired effect. For example: Suppose you backed up /myfs/.snapshot/daily.0/path/mystuff If you backed that up without any src2backup statements at backup time, the backup files will be at /bkup*/myfs/.snapshot/daily.0/path/mystuff To restore them into /myfs/path/mystuff, use d2dbackup --restore --mapsrc2backup /myfs/path:/myfs/.snapshot/daily.0/path /myfs/path/mystuff If you followed our recommendation in HOWTO.snapshots, you used a mapsrc2backup statement in the filesystem-specific configuration file, so the trick will be to NOT use it on the restore. Example of restore a folder to a new location: ---------------------------------------------- Original folder: /myfs/path/mystuff Backup done via snapshot, so the backup was done via /myfs/.snapshot/daily.0/path/mystuff You want to restore this folder in: /newmyfs/newpath/newmystuff Suppose you backed up /myfs/.snapshot/daily.0/path/mystuff If you backed that up without any src2backup statements at backup time, the backup files will be at /backup[]/bkup*/myfs/.snapshot/daily.0/path/mystuff To restore them into /newmyfs/newpath/newmystuff d2dbackup --restore --mapsrc2backup /newmyfs/newpath/newmystuff:/myfs/.snapshot/daily.0/path /myfs/path/mystuff If you followed our recommendation in HOWTO.snapshots, you used a mapsrc2backup statement in the filesystem-specific configuration file, so the trick will be to NOT use it on the restore.