Commands‎ > ‎

Recover

Recovers backup files stored on a remote destination.  This command would be used if the disk containing your local backup directory fails, or if a backup archive file or the main database is accidentally deleted from your local backup directory.

  $ hb recover
-c backupdir [destname] [--force] [-n] [-a]

The recover command will fetch all backup files from the remote destination that do not exist in the local backup directory and copy them to the local backup directory.  This copy also occurs if the local file exists but is a different size than the remote file.

To do a full recover, create an empty backup directory, copy the original backup's key.conf and dest.conf files there, then run the recover command.  You do not run the init command before recover.
 
The --force option causes recovery to start without a confirmation prompt.

The -n option skips downloading of any archive files.  Normally archive files are recovered if the cache-size-limit config option is -1 (the default), but this may be a lot of data.  In a disaster recovery situation, only some critical files may need to be restored immediately.  By using -n,  the local backup directory can be recovered quickly, the hb get command can be used to restore the critical files (downloading only the required archives), then the recover command without -n can be used later to recover all archive files.

The -a option downloads archive files even if they already exist in the local backup directory.  This can be used if the local copies are suspect for some reason.

VERY IMPORTANT: in the event of a disk failure, you must have a copy of the dest.conf and key.conf files from your backup directory.  These files are never copied to remote destinations.  The dest.conf file is required to recover your backup from an offsite server, and the key.conf file is required to decode your encrypted backup data.  You must copy your dest.conf and key.conf files to one or more USB flash drives, or print these files, and store the copies in several locations separate from the backup data.  If your backup is passphrase protected, you must also know the passphrase.

NOTES:
  • The RECOVER command fetches the backup database and archive files; it does not fetch individual files or directories that you may have backed up.  For example, you can't restore the /etc directory using the RECOVER command; use the GET command instead.
  • If you want to force recovery of a few arc files from the remote destination, delete them from the local backup directory and then run recover.
  • To recover all files from a remote destination, create a new directory with only the dest.conf and key.conf files, then run recover -c with this new directory.
  • If the local archive cache size is limited with the cache-size-limit config option, recover will not download archive files, even with -a.

EXAMPLE RECOVER SESSION:


$ hb recover -c /hbbackup
Backup directory: /hbbackup

Recovering backup files from destination: bsrsync
Files will be copied to: /hbbackup

Proceed with recovery? y

Getting dest.db from bsrsync
Getting hb.db from bsrsync
  Loading /hbdir/hb.db.157
  Loading /hbdir/hb.db.158
  Loading /hbdir/hb.db.159
  Loading /hbdir/hb.db.160
  Loading /hbdir/hb.db.163
  ...
  Loading /hbdir/hb.db.259
  Loading /hbdir/hb.db.260
Getting arc.0.0 from bsrsync
Writing archive 0.0
Getting arc.0.1 from bsrsync
Converting arc.0.1
Writing archive 0.1
...
Getting arc.230.0 from bsrsync
Getting arc.231.0 from bsrsync
Getting arc.260.0 from bsrsync

Backup files recovered to: /hbbackup
Verify your backup is intact with the selftest command:
hb selftest -c /hbbackup
$


EXAMPLE SESSION NOTES:
  • It is normal to have skips in the hb.db incrementals.
  • Files are downloaded in an unpredictable order.  The backup directory is not usable until recover has finished.
  • The message about converting archives only occurs if the archive file format has changed since the archive was stored on the remote destination.
  • For large backups, a full selftest can take a long time.  It can safely be interrupted if it takes too long.  If a quick recovery is required, at least do hb selftest -v1 and wait until it says Verified DB integrity.  This usually takes just a few minutes.  Then use Ctrl-c to interrupt the selftest.
Comments