Restores files and directories from a backup.
$ hb get [-c backupdir] [-r version] [-v level]
[--delete] [--orig] [--todev blockdev] pathnames
All pathnames must be full paths, starting with /. To restore a path, the user running hb get must have read permission to the path as stored in the backup. The superuser (root) can restore anything.
By default, the get command restores files to the current directory. For example, if you restore /etc/rc.conf, a new rc.conf file will be created in the current directory. If you restore /etc, then a new etc directory will be created in the current directory. For extra safety, you may want to cd to /tmp before doing a restore.
Get always asks before a file or directory is restored over an existing file or directory. Get may sometimes refuse to do a restore over existing data if it believes the restore may not be what you really want. For example, it will not restore a file over an existing non-empty directory with the same name. This can be avoided by restoring to a different location, or removing or renaming the existing file before the restore.
When restoring over existing directories, get normally merges the backup contents with the existing directory. The --delete option deletes existing directory files that are not in the backup. This is similar to rsync's --delete option, and can be used to "sync" a directory to the backup contents. However, the get command is not yet smart enough to not restore existing files that are already equal to the backup contents.
The --orig option causes files to be restored to their original locations.
The -r option selects a specific version to restore. This will restore files that are backed up at this version, or an earlier version as necessary. With -r1, some of the files may have been backed up in version zero, and some backed up in version 1; the get command will automatically select the latest version for each file. If -r is not used, the get command restores files from their most recent backup.
The -v option controls how much output is displayed:
HashBackup handles deleted files correctly: if a directory contains files A and B in backup versions 0 and 1, then file B is deleted and a backup occurs (version 2), then restoring the directory with -r0 or -r1 will restore both files, but restoring with -r2 will restore only file A. If you try to restore file B with -r2, an error message is displayed indicating that the file was deleted in version 2. You can restore the deleted file B by using -r0 or -r1.
Raw Block Device Restores
When a raw block device is restored, the data can be stored in 3 locations:
# hb backup -c hb /dev/mapper/ub1264-swap_1
HashBackup build 971 Copyright 2009-2013 HashBackup, LLC
Backup directory: /home/jim/hb
Adding symlink target to backup: /dev/mapper/ub1264-swap_1 -> /dev/mapper/../dm-1
This is backup version: 0
Dedup is not enabled
If you restore the symlink, only the symlink is restored. To restore the block device, use the actual block device name, /dev/dm-1 in this example, not the symlink.