Backup with Dirvish

Dirvish is a fast, disk based, rotating network backup system.

With dirvish you can maintain a set of complete images of your filesystems with unattended creation and expiration. A dirvish backup vault is like a time machine for your data.

Dirvish was originally created by jw schultz .


Dirvish can be run from any UNIX system which has Perl, rsync and a the 2 Perl modules Time::Period and Time::ParseDate

This is how the system was installed

   ssh ubuntu-karmic-server
   cd /tmp
   apt-get source dirvish
   mount backupserver:/export/hosts /backup
   cp -r dirvish-1.2.1 /backup

Then on the client

   ssh client
   mount backupserver:/export/hosts /backup
   perl -MCPAN -e shell
   install Time::Period
   install Time::ParseDate
   cd /backup/dirvish-1.2.1
   perl to use (/usr/bin/perl) 
   What installation prefix should be used? () /backup/dirvish
   Directory to install executables? (/backup/dirvish/bin) 
   Directory to install MANPAGES? (/backup/dirvish/man) 
   Configuration directory (/backup/dirvish/etc) 
   Perl executable to use is /usr/bin/perl
   Dirvish executables to be installed in /backup/dirvish/bin
   Dirvish manpages to be installed in /backup/dirvish/man
   Dirvish will expect its configuration files in /backup/dirvish/etc
   Is this correct? (no/yes/quit) y
   Executables created.
   Install executables and manpages? (no/yes) y
   installing /backup/dirvish/bin/dirvish
   installing /backup/dirvish/bin/dirvish-runall
   installing /backup/dirvish/bin/dirvish-expire
   installing /backup/dirvish/bin/dirvish-locate
   installing /backup/dirvish/man/man8/dirvish.8
   installing /backup/dirvish/man/man8/dirvish-runall.8
   installing /backup/dirvish/man/man8/dirvish-expire.8
   installing /backup/dirvish/man/man8/dirvish-locate.8
   installing /backup/dirvish/man/man5/dirvish.conf.5
   Installation complete
   Clean installation directory? (no/yes) no

then configure it

   vi /backup/dirvish/etc/master.conf
   mkdir -p /backup/clamps/dirvish
   vi /backup/clamps/dirvish/default.conf
   /backup/dirvish/bin/dirvish --vault clamps --init
   image-default: %Y%m%d
           client  22:00
   expire-default: +1 months
           #       MIN HR    DOM MON       DOW  STRFTIME_FMT
                   *   *     *   *         1    +3 months
                   *   *     1-7 *         1    +1 year
                   *   *     1-7 1,4,7,10  1
                   *   10-20 *   *         *    +4 days
   sample backup for client /home directory:
   client: client
   tree: /home
   branch-default: daily
   image-default: %Y%m%d

Client setup

If you do not want rsync over ssh from client, you can do the following to allow a system under the subnet to backup its own directories:

 - mkdir /backup
 - mount backupserver:/export/backup/hosts /backup
 - cd /backup
 - export PATH=$PATH:/backup/dirvish/bin
 - `hostname`
 - edit `hostname`/dirvish/default.conf with the right trees to backup
 - /backup/dirvish/bin/dirvish --vault `hostname` --init

Automatic configuration

Linux fstab

   backupserver:/export/backup/hosts /backup nfs   defaults    0   0

Solaris vfstab

   backupserver:/export/backup/hosts    - /backup  nfs - yes rsize=32768,wsize=32768

Cron Job


edit /etc/cron.d/dirvish (this is managed by administration:cfengine)

backup data to backupserver:/backup/hostname

   0 0 * * * root [ -x /backup/dirvish/bin/dirvish-expire ] && /backup/dirvish/bin/dirvish-expire --quiet
   0 1 * * * root [ -x /backup/dirvish/bin/dirvish ] && /backup/dirvish/bin/dirvish --vault `hostname`


crontab -l (this is managed by administration:cfengine)

   0 0 * * * [ -x /backup/dirvish/bin/dirvish-expire ] && /backup/dirvish/bin/dirvish-expire --quiet
   0 1 * * * [ -x /backup/dirvish/bin/dirvish ] && /backup/dirvish/bin/dirvish --vault `hostname`

Perl Modules

If you get an error about missing Perl modules, install them from CPAN or by doing:

 - mkdir /sources
 - mount backupserver:/export/sources /sources
 - cd /tmp
 - tar xf /sources/CPAN/sources/authors/id/M/MU/MUIR/modules/Time-modules-2006.0814.tar
 - cd Time-modules-*
 - perl Makefile.PL
 - make; make install


On debian systems you can install using apt-get

   sudo apt-get install libtime-period-perl libtime-modules-perl

More Information