dar is a full featured backup tool, aimed for disks (floppy, CD-R(W), DVD-R(W), zip, jazz, hard-disks, usb keys, etc.). The dar (“disk archiver”) command is intended to replace tar by offering more backup and archiving functionality. It is especially useful at creating full, differential, and incremental backups.
If you encounter the below error while running the dar command:
dar: command not found
you may try installing the below package as per your choice of distribution:
OS Distribution | Command |
---|---|
OS X | brew install dar |
Debian | apt-get install dar |
Ubuntu | apt-get install dar |
Kali Linux | apt-get install dar |
Fedora | dnf install dar |
Raspbian | apt-get install dar |
dar Command Examples
1. The following command creates a full backup of the mydata directory and outputs a backup file named full.bak:
# dar -R mydata -c full.bak
2. To create a differential backup (diff1.bak), you can reference the full backup using the -A option:
# dar -R mydata -c diff1.bak -A full.bak
3. You can then create more differential backups as needed by referencing the full backup with the -A option. However, to perform incremental backups instead, you need to reference the previous incremental backup, like so:
# dar -R mydata -c incr1.bak -A full.bak # dar -R mydata -c incr2.bak -A incr1.bak
4. The -x (extract) option is used to recover a backup. If you performed differential backups, you need to first extract the full backup, then the latest differential backup:
# dar -x full.bak # dar -x diff1.bak -w
5. The -w option automatically overwrites changes to files; otherwise, you will be prompted to confirm. To recover an incremental backup, you need to first extract the full backup, then each incremental backup, in order:
# dar -x full.bak # dar -x incr1.bak -w # dar -x incr2.bak -w