Commands‎ > ‎

Export

Exports a backup directory for technical support.

    hb export -c backupdir


The export command creates a tar file of a backup directory for HB technical support to use to solve customer problems.

Advantages of export:
  • rekeys a copy of the database, so your backup key in key.conf is not disclosed
  • an optional passphrase secures your exported backup data, even on publicly-accessible storage
  • clears backup keys stored in the database
  • clears all file and block hashes
  • clears destination credentials
  • creates a "dummy" dest.conf, with only the names of your destinations
  • export's tar file is compressed and about half the size tar would create
The backup is exported as backupdir/export.tar.  An export does not contain any file contents, but does contain filenames, permissions, and other information that the Unix ls -l command might display, and HB metadata such as block numbers, backup times and statistics.

IMPORTANT: an export is not a backup of your database and cannot be used to restore data!  Critical information has been stripped out for privacy reasons.

To see what is included in a HashBackup export, use tar -tf export.tar, or use tar -xf export.tar to expand the tar file as in this example:

# create a new backup directory

$ hb init -c hb
HashBackup build #1502 Copyright 2009-2016 HashBackup, LLC
Backup directory: /test/hb
Permissions set for owner access only
Created key file /test/hb/key.conf
Key file set to read-only
Setting include/exclude defaults: /test/hb/inex.conf

VERY IMPORTANT: your backup is encrypted and can only be accessed with
the encryption key, stored in the file:
    /test/hb/key.conf
You MUST make copies of this file and store them in a secure location,
separate from your computer and backup data.  If your hard drive fails,
you will need this key to restore your files.  If you setup any
remote destinations in dest.conf, that file should be copied too.
       
Backup directory initialized

# do a small backup

$ hb backup -c hb .profile
HashBackup build #1502 Copyright 2009-2016 HashBackup, LLC
Backup directory: /test/hb
Copied HB program to /test/hb/hb#1502
This is backup version: 0
Dedup is not enabled
/test/.profile

Time: 0.2s
Checked: 4 paths, 884 bytes, 884 B
Saved: 4 paths, 884 bytes, 884 B
Excluded: 0
Dupbytes: 0
Compression: 29%, 1.4:1
Space: 624 B, 139 KB total
No errors

# export the backup; creates hb/export.tar

$ hb export -c hb
HashBackup build #1502 Copyright 2009-2016 HashBackup, LLC
Backup directory: /test/hb
Copying databases to export directory
Backup directory: /test/hb/export
Generating new random key with passphrase
New passphrase?
New passphrase again?
Copied old key to /test/hb/export/key.conf.orig
Created key file /test/hb/export/key.conf
Key file set to read-only
Deleting original key from export directory
Rekeying exported databases with new key
Clearing backup keys
Clearing file hashes
Clearing block hashes
Generating export files
Creating export.tar file in backup directory
Deleting export temp files
Tar file is: /test/hb/export.tar

IMPORTANT: this export is not a backup of your HB database.
Information has been removed and file data cannot be restored
using this export.  Its only purpose is for HB tech support.

# export file goes in the backup directory

$ ls -l hb
total 32560
-rw-r--r--  1 jim  staff        65 Apr 25 14:12 HBID
-rw-r--r--  1 jim  staff       624 Apr 25 14:12 arc.0.0
-rw-r--r--  1 jim  staff    315575 Apr 25 14:12 cacerts.crt
-rw-r--r--  1 jim  staff      4096 Apr 25 14:12 dest.db
-rw-r--r--  1 jim  staff     12288 Apr 25 14:12 export.tar
-rw-r--r--  1 jim  staff   3146512 Apr 25 14:12 hash.db
-rwxr-xr-x  1 jim  staff  13025016 Apr 18 17:38 hb#1502
-rw-r--r--  1 jim  staff    139264 Apr 25 14:12 hb.db
-rw-r--r--  1 jim  staff         6 Apr 25 14:12 hb.lock
-rw-r--r--  1 jim  staff       511 Apr 25 14:12 inex.conf
-r--------  1 jim  staff       333 Apr 25 14:12 key.conf

# what's in the export file?

$ tar -tf hb/export.tar
export/
export/dest.db
export/hb.db.0
export/key.conf

# expand the export file, creating an export backup directory
# This is what HB tech support does with an export .tar file

$ tar -xvf hb/export.tar
x export/
x export/dest.db
x export/hb.db.0
x export/key.conf

# what's in the new backup directory?

$ ls -l export
total 32
-rw-r--r--  1 jim  staff  4096 Apr 25 14:12 dest.db
-rw-r--r--  1 jim  staff  4244 Apr 25 14:12 hb.db.0
-r--------  1 jim  staff   346 Apr 25 14:12 key.conf

# the first HB command re-creates hb.db;
# file hashes have been changed to spaces

$ hb ls -c export -lv
HashBackup build #1502 Copyright 2009-2016 HashBackup, LLC
Passphrase?
  Loading /Users/jim/export/hb.db.0
  Verified signature
Verified hb.db signature
Backup directory: /Users/jim/export
Most recent backup version: 0
Showing most recent version
   0 drwxrwxr-t   43    0   80     1530 2016-04-23 00:30:05 2016-04-25 14:12:27 /  (parent, partial)
            2 2016-04-23 00:30:05          1
   0 drwxr-xr-x    7    0   80      238 2016-01-24 22:54:40 2016-04-25 14:12:27 /Users  (parent, partial)
       644856 2016-01-25 10:03:14          2
   0 drwxr-xr-x  160  501   20     5440 2016-04-25 14:12:17 2016-04-25 14:12:27 /Users/jim  (parent, partial)
       644859 2016-04-25 14:12:17          3
   0 -rw-r--r--    1  501   20      884 2016-01-16 11:44:07 2016-04-25 14:12:27 /Users/jim/.profile
       645018 2016-01-24 20:07:51          4                              [2020202020202020202020202020202020202020]

# try to do a selftest with the exported data;
# errors occur because there is no backup data

$ hb selftest -c export -v4
HashBackup build #1502 Copyright 2009-2016 HashBackup, LLC
Passphrase?
Backup directory: /test/export
Most recent backup version: 0
Checking all versions
Checking database readable
Checked  database readable
Checking database integrity
Checked  database integrity
Checking paths I
Checked  paths I
Checking keys
Checked  keys
Checking arcs I
Error: arc.0.0 is not local nor on any destination
1 errors
Checked  arcs I
Checking blocks I
Getting arc.0.0
Unable to download archive arc.0.0: Exception('No destinations configured in dest.conf',)
Error: unable to open arc.0.0 from (local): Error opening archive: Archive does not exist: /test/export/arc.0.0: /test/export/arc.0.0
Checking arc.0.0
Error: unable to get block 1 of arc.0.0 from (local): bad arc file
Checked  1 blocks I    
Checking refs I
Checked  1 refs I    
Checking arcs II
Checked  arcs II
Checking dedup table
Checked  dedup table
Checking files
Checked  4 files
Checking paths II
Checked  paths II
Checking blocks II
Checked  blocks II
3 errors

# try to restore from exported backup;
# can't because there is no backup data

$ hb get -c export /test/.profile
HashBackup build #1502 Copyright 2009-2016 HashBackup, LLC
Passphrase?
Backup directory: /test/export
Most recent backup version: 0
Restoring most recent version

Restoring .profile to /test
Path already exists with same mtime as backup file: /test/.profile
  Existing file last modified on: 2016-01-16 11:44:07
  Backup file last modified on:   2016-01-16 11:44:07
Warning: existing file will be deleted after restore!
Restore? yes
/test/.profile
Getting arc.0.0
Unable to download archive arc.0.0: Exception('No destinations configured in dest.conf',)
Warning: partially restored file: /test/.profile
Unable to restore /test/.profile: Error opening archive: Archive does not exist: /test/export/arc.0.0: /test/export/arc.0.0
Not restored: /test/.profile
1 errors



Comments