Tune

Optimizes the backup database.

$ hb tune [-c backupdir] [--force]

Without options, tunes the backup database if it appears necessary. Tuning is optional, but usually decreases the size of the backup database slightly, makes it more effficient to access, causes selftest to use less RAM, and increases the capacity of the backup.

Options

The --force option tunes the database when there is only slight benefit because it was recently tuned.

What It Does

Tune does not modify any data stored on destinations and does not upload its changes. The next backup will upload the modified database when the backup finishes. Tune checkpoints its progress, is safe to interrupt, and can be restarted though doesn’t have to be restarted.

Tune compacts database keys to increase backup capacity. HashBackup has capacity limits that most sites will never see, but over a few years, some large sites may bump into them. Running tune is like a reset, making more key space available for future backups.

Running tune once a year is all most sites will need, though there is no harm in running it after every backup if it doesn’t take too long. The first tune takes about as long as a selftest -v2 (or no -v option) that doesn’t download data. In tests on the HashBackup dev server backup, selftest took about 16 minutes, the first tune took about 8 minutes, and subsequent tunes took a couple of minutes. For the "Tuning db" phase, tune needs enough free disk space to make a copy of the database.

Test Tune

The tune command is new, but has been tested with several old and/or large production backups. This example shows how to try it on an isolated backup database before using it on a production backup:

$ mkdir temp
$ cp /hbbackup/hb.db /hbbackup/key.conf temp
$ hb dest -c temp unload
HashBackup #2761 Copyright 2009-2022 HashBackup, LLC
Warning: logging disabled
No dest.conf loaded into the database; use dest load first
$ rm temp/dest.conf
rm: temp/dest.conf: No such file or directory
$ hb selftest -c temp --iso
HashBackup #2762 Copyright 2009-2022 HashBackup, LLC
Warning: logging disabled
Backup directory: /Users/jim/temp
Most recent backup version: 21
Warning: cache-size-limit ignored: no active destinations
Level -v2 check; higher -v levels check more backup data
Checking all versions
Checking database readable
Checked  database readable
Checking database integrity
Checked  database integrity
Checking dedup table
Checked  dedup table
Checking paths I
Checked  paths I
Checking keys
Checked  keys
Checking arcs I
Checked  arcs I
Checking blocks I
Checked  87121 blocks I
Checking refs I
Checked  144141 refs I
Checking arcs II
Checked  arcs II
Checking files
Checking file 10000 - 7%
...
Checking file 130000 - 93%
Checked  139707 files
Checking paths II
Checked  paths II
Checking blocks II
Checked  blocks II
No errors
$ hb tune -c temp
HashBackup #2761 Copyright 2009-2022 HashBackup, LLC
Warning: logging disabled
Backup directory: /Users/jim/temp
Tuning versions
Tuning files
Tuned  139707 files already
Tuning arcs
Tuned  arcs
Tuning blocks
Tuned  87121 blocks already
Tuning db
Tuned  db in 0s
Tuning stats
Tuned  stats in 0s
Tune finished
$ hb selftest -c temp --iso
HashBackup #2762 Copyright 2009-2022 HashBackup, LLC
Warning: logging disabled
Backup directory: /Users/jim/temp
Most recent backup version: 21
Warning: cache-size-limit ignored: no active destinations
Level -v2 check; higher -v levels check more backup data
Checking all versions
Checking database readable
Checked  database readable
Checking database integrity
Checked  database integrity
Checking dedup table
Checked  dedup table
Checking paths I
Checked  paths I
Checking keys
Checked  keys
Checking arcs I
Checked  arcs I
Checking blocks I
Checked  87121 blocks I
Checking refs I
Checked  144141 refs I
Checking arcs II
Checked  arcs II
Checking files
Checking file 10000 - 7%
...
Checking file 130000 - 93%
Checked  139707 files
Checking paths II
Checked  paths II
Checking blocks II
Checked  blocks II
No errors
$ rm -rf temp
$
Don’t copy the tuned database back to your production backup directory as something could have changed there during your tuning tests. Instead, run it directly on the production backup when you’re ready.

In tests on the HashBackup dev server backup from 2010, tune reduced the database size by about 10%, reduced selftest RAM usage by 78%, reduced selftest runtime by 15%, and increased block keyspace 15x.