Commands‎ > ‎


Sets and displays configuration options.  These options are stored in the main database, with a history of options used for every backup.

$ hb config [-c backupdir] [-r version] [key] [value]


Display current configuration, for the next backup:
$ hb config -c backupdir

Display the configuration used for backup version 5:
$ hb config -c backupdir -r5

Set key arc-size-limit to 1gb (used for the next backup):
$ hb config -c backupdir arc-size-limit 1gb

Display key arc-size-limit:
$ hb config -c backupdir arc-size-limit

Display key arc-size-limit used for backup version 5:
$ hb config -c backupdir -r5 arc-size-limit

Config changes take effect on the next backup.  If you need config options to be sent to remotes immediately, use:
$ hb dest -c backupdir sync

Config Options (Keywords

admin-passphrase    an admin passphrase can restrict certain actions unless the passphrase is known.  This option is used
to protect the config data from changes, to protect dest.conf data stored in the database (see Dest command), and with the enable-commands and disable-commands options.

arc-size-limit    specifies the maximum size of archive files.  The default is 100mb.  The minimum size is 10k, but that is only used for internal testing.  
HashBackup may go slightly over the limit specified, so if you need a hard limit for some reason, specify 5-10MB less.  At least 2 x arc-size-limit bytes of free disk space will be required in the local backup directory.

For huge, multi-TB backups with mostly large files that do not change often, a large archive size may be more efficient.  A practical limit is around 4GB, because many storage services do not allow file sizes over 5GB without special handling.  If you specify an arc size > 4GB, add a larger maxsize keyword to your dest.conf file to prevent splitting an arc file on upload.  For example, with arc-size-limit 10GB, add maxsize 11GB to dest.conf.  Be aware that some destinations have a maximum upload file size.

For VM image backups with a lot of dedup, high rate of change, and/or small block sizes, a smaller arc size may be more efficient.  A smaller arc size reduces cache requirements during a restore, if local disk space is tight; this is only a concern when cache-size-limit is >= 0.

As files are removed with the rm or retain commands, it creates holes (empty space) in your archives.  If enough data is removed, more than
pack-percent-free, archives are automatically packed to remove empty space
(see pack-percent-freepack=free-bytes, page-age-days options).  If all data from an archive is removed, the archive is deleted without needing a pack operation.  This is why smaller archive files can be more space efficient than larger files: when data is removed, smaller arc files increase the probability that whole arc files can be removed without a pack.

A disadvantage of very small arc files, besides creating many arc files for large backups, is that very small arc files may defeat download optimizations.  For example, with 1MB arc files, the maximum request size is limited to 1MB; a backup of a 1GB file will create 1000 arc files and downloading this will require 1000 x 1MB requests.  If the storage service has high latency (delay for each request) it can cause performance problems.  Using arc-size-limit below 4MB is not recommended, and in general, arc-size-limit should be somewhat proportional to your backup size.

audit-commands    list of commands, separated by commas, that should be audited by recording details of each use.  To audit all commands, use the value all.  The hb audit command displays the audit log.  The audit log cannot be deleted or changed. 
To disable auditing, use the value '' (two single quotes).

backup-block-size    sets the backup block size for specific filename extensions (suffixes).  For example, with '-B4M mov,avi -B8K ibd', backup will use large 4M blocks for movie and video files, but small 8K blocks for an Innodb database file.  Commas and periods are optional.  The value must be quoted since it contains spaces.
backup-linux-attrs    when True, backup will save Linux file system attributes, also called flags in BSD Unix.    On Linux, file attributes are set with the chattr command and displayed with lsattr.  They are little used and poorly implemented on Linux, requiring an open file descriptor and an ioctl call.  This can cause permission problems, especially in shared hosting environments, so the default is False.

File attributes are not the same as extended attributes, also called xattrs.  Extended attributes are always backed up if present.  Xattrs are handled by the attr, setfattr, and setfattr commands on Linux, as well as the Linux ACL commands.

cache-size-limit  spec
ifies the maximum amount of space to use in the local backup directory to cache archive files.  By default, this is -1, meaning to keep local copies of all archive files.  Setting cache-size-limit to any other value will restrict the number of archives kept locally.  Remote destinations must be setup in dest.conf or this config option is ignored.  The cache size limit is more of a desired goal than a hard limit.  The limit may often be exceeded by the size of 1 archive file, and may need to be greatly exceeded for restores to prevent downloading the same archive file more than once.  The mount command respects the limit but might require downloading the same file more than once.  A reasonable value for this limit is the average size of your incremental backups.  A reasonable minimum is the highest workers setting for any destination plus 1.  The default number of workers is 2, so the minimum would be 3, but a more reasonable limit would be 1GB (for 100MB arc files).  If you plan to use the mount command extensively, a larger cache will prevent multiple downloads of the same data.

If you can afford the disk space, keeping a copy of archives locally has many advantages: backups won't stall, mount does not need to download data and can run concurrently with backups, restores will not have to wait for lengthy downloads, archive pack operations are faster (no download is required), less 
remote storage space is used because pack operations occur more frequently, and you have a redundant copy of your backup.  Total backup space is usually about 50%-100% the size of the original data, even when multiple versions are maintained.

Examples of cache size limits:

  • -1 means copies of all archives are kept in the local backup directory.  This is the default setting.
  • 0 means no archives should be kept locally.  During backup, up to 2 archives are kept to ensure overlap between backup and network transmission.  After the backup completes, all local arc files are deleted.
  • 1-1000 means to size the cache to hold this many full archives.  If the archive size is 100MB and the limit is set to 10, the effective cache size would be 1gb.  A guideline is to use workers (in dest.conf) + 1 as a minimum.
  • 10gb specifies the cache size directly.  Other suffixes can be used: mb, kb, etc.
copy-executable    when True, copy the hb program to remote destinations.  The default is False.  The hb program is always copied to the local backup directory as hb#b, where b is the build number.  The last 3 versions are kept in the local backup directory.  If using HB only occasionally, more as an archive, it is important to set this true so that you will have a copy of HB stored with your archive.

dbid           a read-only config option that is unique for each backup database

dbrev        a read-only config option describing the database revision level

dedup-mem    specifies the amount of RAM to be used for the dedup table, similar to the -D backup option.  The -D option overrides this config option.  See Dedup Info for more detailed information about sizing the dedup table.  The default is 0, meaning dedup is disabled.  A reasonable value is 1gb.  The dedup table does not immediately use all memory specified; it starts small and doubles in size when necessary, up to this limit.  The backup command shows how full the current dedup table is, and how full it is compared to the maximum table size.  When the dedup table is full and cannot be expanded, backups will continue to work correctly; dedup is still very effective even with a full table.

disable-commands    list of commands that should be disabled, separated by commas; all other commands are enabled.  If the admin-passphrase option is set, these commands will ask for the passphrase and run only if it is correctly entered.  If there is no admin-passphrase set, these commands refuse to run.  The upgrade and init commands cannot be disabled because when these commands execute there is no database to check whether they should be enabled or disabled.  For a backup-only config, commands to disable would be clear, config, dest, readkey, recover, rekey, rename, retain, and rm.
  To cancel this option, use the value '' (two single quotes).
SECURITY NOTE: Disabling commands without an admin passphrase is a poor configuration since commands can easily be re-enabled.

enable-commands    list of commands that should be enabled
, separated by commas; all other commands are disabled.  An example would be to enable only the backup command.  Then it would not be possible to list, restore, or remove files without the admin passphrase.  To cancel this option, use the value '' (two single quotes).
SECURITY NOTE: Disabling commands without an admin passphrase is a poor configuration since commands can easily be re-enabled.

when True, the get command will compress files on Mac OSX that were originally compressed during the backup.  The default is False because the OSX tool used to compress files is very slow - about 10x slower than a normal restore - and the files will work correctly uncompressed.

no-backup-ext    list of file extensions, with or without dots, separated by spaces or commas.  Files with these extensions will not be backed up.

no-backup-tag    list of filenames separated by spaces or commas.  Directories containing any of these files will not have their contents backed up, other than the tag file(s).  Typical values are .nobackup and CACHEDIR.TAG  Each entry in this list causes an extra stat system call for every directory in the backup, so keep the size of this list to a minimum.

no-compress-ext  list of file extensions of files that should not be compressed.  Most common extensions are already programmed into the backup program, but you can list less common extensions here.  Extensions may or may not have dots, and are separated by spaces or commas.

no-dedup-ext      list of file extensions of files with data that does not dedup well, for example, photos.  If exact copies are backed up, they will be still be deduped (if dedup is enabled).

pack-age-days        the minimum age of an archive before it is packed.  Some storage services charge penalties for early removal of files, for example, Amazon S3 Infrequent Access and Google Nearline.  This setting prevents packing archives until they have aged, avoiding the delete penalty charge.  All other conditions must be satisfied before an archive is packed. 
The default for pack-age-days is 30.  To disable this feature, set it to zero.  Higher numbers will increase the backup storage requirements but reduce the number of pack operations.  If you do not pay delete penalties and have low or zero download fees or have cache-size-limit set to -1 (local copy of arc files), setting this to zero will cause more frequent packing but lower storage costs, improve restore times, and lower restore cache requirements.

               the minimum free space in an archive before it is packed.  This setting prevents packing very small archives when data is removed, ie, once an archive gets down to 1MB (the default setting), it is not packed until it is empty, then is deleted.  All other conditions such as pack-percent-free must also be satisifed before the archive is packed. The default for pack-bytes-free is 1MB.  To disable this feature, set it to 4K (the minimum value).   Higher numbers will increase the backup storage requirements and reduce the number of pack operations.

pack-combine-min    the minimum size of an arc file before it is merged into a larger arc file.  The default is 1MB, meaning that any consecutive series of arc files smaller than 1MB will be merged until they are at least  pack-combine-max bytes.  For combining to occur, packing must occur (see the other pack-related config settings).  For technical reasons, only consecutive arc files can be merged into larger arc files.

pack-combine-max    the maximum size of combined arc files, default 5MB.  For example, with the default settings, a consecutive series of 20 x 1MB arc files will be combined into 4 x 5MB arc files.  Arc files can be combined into larger files if necessary to reduce the number of arc files.

pack-percent-free    when archive files have this percentage or more as free space, the archive is packed to recover disk space.  This is used by rm and retain after they have deleted backup data.  The default is 50.  If cache-size-limit is >= 0 and pack-remote-archives is True, consider raising this percentage to avoid frequent packing.  Most storage services have very high download charges compared to their storage charge, often 10-17x higher.  If cache-size-limit is not set (the default), packing more often is okay because no download is required.    Higher numbers will increase the backup storage requirements but reduce the number of pack operations and reduce the number of downloads when cache-size-limit is >= 0.

pack-remote-archives    if cache-size-limit is >= 0, some archives may be local and some may only be remote.  If pack-remote-archives is false (the default), remote-only archives will not be downloaded and packed.  This may be important because the data transfer fees for retrieving an archive from a remote destination to pack it are usually 10-17x higher than leaving extra data on the remote and paying the storage charges.  When this option is true, remote archives are downloaded, packed, and then uploaded to save storage costs on the remote.  The best setting for this is probably false, though it depends on your incoming and outgoing bandwidth fees, storage fees, and volatility of your backup data (how much data is removed by rm and retain).  If you do not pay download fees, this can be set to true.

remote-update    when set to normal, HB sends new data before deleting old data.  This preserves the integrity of remote backup areas.  However, if a remote disk becomes full, it may be necessary to delete the old data before sending new data.  To enable this behavior, set to unsafe
IMPORTANT: when set to unsafe, an interrupted HB command may leave the remote backup area temporarily inconsistent.  The next successful HB command should correct it.

simulated-backup    this keyword can be set to true before the first backup.  When set true, no arc files are created by the backup command.  This allows modeling backup options such as -B (blocks size),  -D (dedup table size), and -Z (compression level), even for very large backups, without using a lot of disk space.  Simulated backups also run faster because there is less I/O.  Incremental backups work correctly, and the stats command can be used to view statistics such as the backup space that would be used by a real backup.  The pack-remote-archives keyword controls whether the simulated arc files are packed when files are removed from the backup with rm or retain.

Differences for a simulated backup:
- must be set before the initial backup
- cannot be changed after the initial backup
- no arc files are created (not a real backup)
- no files are sent to remote destinations
- selftest is limited to -v2
- get & mount will fail with "No archive" errors
- rm, retain, and incremental backups work