Scroll to navigation

hdup(1) General Commands Manual hdup(1)


hdup - harddisk duplicator/harddisk backupper - backup to harddisk


hdup [ OPTION ] SCHEME HOST [ @USER@REMOTEHOST ] (1st format)
hdup [ OPTION ] restore HOST DATE DIRECTORY [ @USER@REMOTEHOST ] (2nd format)


Hdup is used to backup a filesystem. Features include:

incremental backups: monthly, weekly and daily dumps,
encryption of the archive (via mcrypt or GPG),
compression of the archive (bzip/gzip/lzop/none),
possibility to transfer the archive to a remote host,
possibility to restore the archive from a remote host,
ability to split up archives,
no obscure archive format (it is a normal compressed tar file), and
simple to use.

The behaviour of hdup is controlled by its configuration file (see hdup.conf(5)). Internally hdup uses GNU tar to actually create the backups.

First format

When using the 1st format hdup performs a backup. Remember: hdup pushes a backup from the localhost to the remote host.

The sort of backup is specified by SCHEME:

Make a full (null) dump of the filesystem.
Make an incremental dump of the filesystem relative to the latest monthly dump. If hdup cannot find a monthly dump it will complain, unless always backup is on. Then a monthly dump will be performed.
Make an incremental dump of the filesystem relative to the latest weekly dump. If hdup cannot find a weekly dump it will complain, unless always backup is on. Then a weekly dump will be performed.

HOST is the host of which hdup should perform the backup. This should match a '[HOST]' statement in the configuration file. The directories of that host (specified with 'dir = dir1, dir2', ...) will be backed up to the directory specified with 'archive dir = dir'. If HOST is not found no backup will be made.

@USER@REMOTEHOST is the host to which the archive should be transfered. This must include the user name. E.g It is illegal to specify the colon ':'. hdup must be present on the remote host. The location of this remote hdup is specified using remote hdup.

Any program capable of transferring files can used for this purpose. Currently tested is ssh. Other programs like rsync (not tested) may also work. Any program with the following characteristics will do:

must be usable as a filter (read from stdin, write to stdout),
must support user@remotehost syntax.

Second format

When using the 2nd format a previous backed up filesystem is restored. Remember: hdup pushes a restore from the remote to the local host. This is opposite from the backup operation!

HOST is the host who's archives should be restored.

DATE everything up to this date will be restored. hdup will look for the most recent monthly archive, then the most recent weekly and finally for the daily to pad up to date given. The DATE can either be specified as DD-MM-YYYY (date spec = default), as YYYY-MM-DD (date spec = iso) or as MM-DD-YYYY (date spec = american). This is controlled from the configuration file.

A special date is 'static' which instructs hdup to look in the 'static' directory. This is used when 'no history = yes'. This is dangerous to use because hdup will overwrite the old backup file with the new one. When your system crashes during the overwrite you have no backup at all! Only use this when you really don't have room for two monthly backups.

Another special date is 'today' which instructs hdup to use the current date.

DIRECTORY tells hdup to which directory the archive should be untarred to. Be very careful when running hdup as root and specifying '/' as the directory. Version 1.4 and above refuses to restore to '/'. This can be overridden by specifying 'force = on/yes' in the configuration.

@USER@REMOTEHOST is the host to which the archive should be restored. This must include the user name. E.g As as version 1.6.6 it is illegal to specify the colon ':'. On the remosthost and in DIRECTORY the archive is restored. hdup must be present on the remote host.

Status message

When hdup is finished with its current operation it will print an overview message:

Hdup version.: 1.6.6
Host.........: elektron
Date.........: 2003-02-02
Scheme.......: monthly
Archive......: elektron.2003-02-02.monthly.tar.gz
Encryption...: no
Archive size.: 257k
Elapsed......: 0:01:27
Status.......: successfully performed backup

Which can be mailed to you via cron.


Location of the configuration file. The default location of hdup's configuration file is /etc/hdup/hdup.conf.
Restore a specific file from an archive. file must be the full path to the file, relative paths will not work.
Ignore tar errors when restoring.
Ignore errors in the configuration file.
Tar is patched so that it can handle --no-recursion, --listed-incremental and --files-from together. This options enables two things in hdup; 1) directory info is written to 'filelist' and 2) --no-recursion is given to tar.

This solves the bug whereby hdup wouldn't include directory information in the archives.

Do a dryrun - don't do anything with the filesystem
Suppress the output of the subprocesses (like 'tar' and 'ssh').
Suppress the logging output from hdup.
No logging at all. Even no overview message.
Be more verbose.
-V -V
Be even more verbose. This will show which files are backed up by hdup IF you also supply the -D option.
A help message.
Show the version of hdup.
Show a lot of information which can aid debugging.

The -V and -q options do not effect each other. A '-qqq -VV' option list will mean that hdup will show what is run, but nothing else (no overview message and no warning nor errors).


hdup can encrypt the archives, mcrypt is used for the actual encryption. As of version 1.6.25 GPG can also be used to encrypt the archive. Note that currently remotely restoring a GPG encrypted archives is not working.


With mcrypt --list you get a list of the algorithms mcrypt supports:

serpent (32): cbc cfb ctr ecb ncfb ofb nofb
wake (32): stream
loki97 (32): cbc cfb ctr ecb ncfb ofb nofb
rijndael-128 (32): cbc cfb ctr ecb ncfb ofb nofb
rijndael-192 (32): cbc cfb ctr ecb ncfb ofb nofb

If you want to use loki97 you specify algorithm = loki97 in hdup.conf. The same goes for all the other algorithms.


To use GPG the following is needed. Set algorithm = gpg and key = user ID of key. In my case I've created a GPG key with user ID of 'miekg' so I use:
algorithm = gpg
key = miekg
The key is supplied to gpg with the -r argument. See the manpage of gpg for more details.

When restoring a GPG encrypted archive you will be prompted to unlock your private key.


Written by Miek Gieben. Wouter van Gils helped a lot with testing pre-release versions. User feedback is appreciated.


Report bugs to <>.


The %a expansion is not always the same in the prerun and postrun scripts (when using encryption).


Under Linux kernel version 2.2 the archive size cannot exceed two (2) Gigabyte. If you need larger archives sizes you should upgrade your kernel. You can however solve this by using chunk size. Just define your maximum allowed size, something like chunk size = 1800M and you're set.

If you encrypt archives and want to restore them, you are forced to use one encryption scheme for all the backups. hdup does not store the key and algorithm with the archive, thus it is impossible to restore archives that use different keys and algorithms.


Copyright (C) 2001-2005 Miek Gieben. This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


hdup.conf(5) for information about hdup's configuration file.

18 Mar 2003