Dar Documentation


1- General Presentation

Dar is a command-line software aimed to backup and archiving large live filesystems. It is a filesystem independent and cross platform tool. But, Dar is not a boot loader, nor it is an operating system. It does not create nor format partitions, but it can restore a full filesystem into a larger or a shorter partition, from one partition to several ones, (or the opposite from several to one partition), from a filesystem type to another filesystem type (ext2/3/4 to reiserFS for example), it can save and restore hard-linked inodes (hard linked plain files, sockets, char/block devices or even hard linked symlinks (!)), Solaris's Door files, it takes care of Posix Extended Attributes (Linux, MacOS, ...). It can also detect and restore sparse files, even when the underlying filesystem does not support them: it can restore a normal file with large portions of zeroed bytes as a sparse file on another filesystem that supports it, leading to a gain in space requirement for the restoration but also for the archive size.

From a filesystem, dar creates an archive, which may be split in a set of files (called slices) which size is user defined. Dar archives are suitable to be stored on floppy, CD, DVD, usb key, hard disks, and since release 2.4.0 to tapes too. But no, dar itself cannot burn a DVD. Instead the user can give dar a command to execute each time a slice is completed. Dar can perform full backup1, incremental backup2, differential backup3 and decremental backup4. It also records files that have been removed since the last backup was made, leading the restoration of a system to get the exact same state it was at the time of the differential/incremental/decremental backup (removing files that ought to be removed, adding files that ought to be added and modifing files as expected).

Dar is able to be run on a live filesystem. It can detect when a file has changed while it was reading it, in that case it is possible to ask dar to proceed to several retries to save such a file. File that could not be saved properly (because they changed during the backup and there is no more retry left) are flagged as "dirty" and are signaled at restoration time.

Dar provides several hooks for the user to perform certain actions when some event are met. One first hook let the user launch a command when a slice is completed  (for burning the slice to DVD for example). A second hook is available for a given set of files or directories under backup, that let the user do some action before and after saving that file or directory (like suspending a database, and resuming it afterward).

Dar code has been split into two parts since its release 2.0.0, a command-line part and a library part called libdar. Dar is not a Graphical User Interface it is only a command-line tool, but thanks to the libdar library, many external tool rely on libdar and can manipulate dar archives at a more abstracted level with other interfaces than the shell command-line.

libdar may be linked against libz, libz2, liblzo and libxz to provide gzip, bzip2, lzo and xz/lzma compression. It can also be linked against libgcrypt to provide symmetric strong encryption (blowfish, twofish, aes256, serpent256, camellia256). In addition it can be linked against libgpgme to provide asymmetric encryption (same as GPG) which, in other word, let you cipher an archive with the public key of one or more recipients and in option sign it with our own private key.

Dar can be used through ssh for remote backups. It may also make used of so called "isolated catalogue" which is a small file containing the table of contents (or catalog) of a given archive. These can be used as base for a differential or incremental backup, and can also be used as backup of the table of content of the original archive if that one gets corrupted.

While dar/libdar provide a lot of features we will not mention here, you can use dar without having the knowledge of all of them. In its most simple form, dar can be used only with few options, here follows some example of use, that should not need additional explanations:

archive creation (backing up all /usr directory) :
   dar -c my_backup -R / -g usr
archive restoration (restoring /usr in a alternate directory):
dar -x my_backup -R /some/where/else

archive testing:
dar -t my_backup

archive comparison with an existing filesystem:
   dar -d my_backup -R /

While a big effort has been made on documentation, it must not lead you to think that you have to read it all to be able to use dar: most needs are covered by the tutorial or mini-howto and for direct explanation of common questions by the FAQ. Then, if you like or if you need, you can also look at the detailed man pages for a particular feature (These documents are the reference for each command-line tool you will get very detailed explanations). You may also find some help on the dar-support mailing-list where a bit more than a hundred of subscribed users can help you.

Dar's documentation is big because it also includes all that may be useful to know how to use libdar, which is intended for developpers of external application relying on this library. For those even more curious there is also the documentation about dar's internals: libdar's structure, archive format, which can ease the understanding of the magic that makes all this working and gives a better understanding of dar/libdar code, which is written in C++. But, no, you do not need to read all this to just use dar! ;-)

Follow an abstracted list of features if you want to know more about dar/libdar.

2 - Known Projects relying on dar or libdar

In alphabetical order:
  • AVFS is virtual file system layer for transparently accessing the content of archives and remote directories just like local files.
  • backup.pl script by Bob Rogers, creates and verifies a backup using dump/restore or using dar
  • Baras by Aaron D. Marasco it a rewriting in Perl of SaraB.
  • Dar-incdec-repo by Dan A. Muresan is a framework for doing periodic DAR backups with minimal fuss
  • Darbup by Carlo Teubner. One of darbup key features is its ability to automatically delete old archives when the total space taken up by existing archives exceeds some configured maximum
  • <<new in 2017>> Darbrrd by Jared Jennings, to back up a few hundred gigabytes of data onto dozens of optical discs in a way that it can be restored ten years later.
  • DarGUI by Malcolm Poole is a front-end to dar providing simple and graphical access to the main features of dar.
  • Disk archive interface for Emacs by Stefan Reichör
  • gdar by Tobias Specht, a graphical user interface to browse and extract dar archives
  • HUbackup (Home User backup) by SivanGreen
  • kdar is a KDE-3 Graphical User Interface to dar made by Johnathan Burchill
  • Lazy Backup by Daniel Johnson. Lazy Backup is intended to be so easy even lazy people will do their backups
  • A Dar plugin has been made by Guus Jansman for Midnight commander (mc)
  • Python Bindings by Wesley Leggette
  • SaraB: Schedule And Rotate Automatic Backups - by Tristan Rhodes. SaraB works with DAR to schedule and rotate backups. Supports the Towers of Hanoi, Grandfather-Father-Son, or any custom backup rotation strategy.
If a project you like is missing, you are welcome to contact dar's author for it to be referred here (contact coordinates can be found in the AUTHOR file of the source package).

3 - Limitations

Dar has some limitations which are detailed here.

4 - Staying informed of dar/libdar's events

To stay informed about new releases and security issues please subscribe to the Dar-news mailing-list. This is a read-only mailing-list with very low number of mail (usually less than ten a year).

1 Full backup: A full backup is a backup of a full filesystem or of a subset of files where, for each file, the archive contains all the inode information (ownership, permission, dates, etc.) file's data and eventually file's Extended Attributes.
2 Differential backup: A differential backup is based on a full backup. It contains only the data and Extended Attributes of files that changed since the full backup was made. It also contains the list of files that have been removed since the full backup was made. For files that did not change, it contains only the inode information. The advantage is that the backup process is much faster, the space required is also much lower.  The drawback is that you need to restore the full backup first, then the differential backup to get the last saved state of your system. But if you want the last version of a file that changed recently you only need the last differential backup.
3 Incremental backup: An incremental backup is essentially the same thing as a differential backup. Some make a difference, I do not. The only point I see is that the incremental backup is not based on a full backup but on a differential backup or on another incremental one.
4 Decremental backup: A decremental backup is a backup method in which the most recent backup is a full backup, while the oldest backup are a difference compared to that full backup. The advantage of such type of backup is the you can restore easily your system in the last state it had using only the last backup. And, if you want to restore it in the state it had some time before, then you can restore the last backup (full backup), then the previous archive (a decremental backup) and so on. As you most usually want to restore the system in its last available state, this makes restoration much more easy compared to doing incremental backups. However, this suffer from a important drawback, which is that you need to transform the last backup into a decremental backup when comes the time to make another backup. Then you have to remove the former full backup and replace it by its decremental version.