Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tech:others:backups_with_dirvish [2014/11/15 09:13]
tech:others:backups_with_dirvish [2014/11/15 09:13] (current)
Line 1: Line 1:
 +====== Creating backups with Dirvish ======
 +I love Dirvish for one great reason - it does backup from disk to disk which is the fastest, cheapeast way to backup and restore your data. With the price of Hard Disk falling so much (I wonder if the tape solution is cheaper anymore), it makes perfect sense to backup disk to disk. Also, I usually throw in my backup hard disk side-by-side with my regular hard disk making backups and restore a breeze. I don't think you can make it any better by having your backup inside your system. Now Disaster recovery is another story!
 +
 +===== Setup =====
 +Since there are no latest releases for a while now, the default prepackaged binaries are usually the latest releases available. In fact this might be a drawback of Dirvish as it does not seem to be actively managed. Anyway assuming you still want to use it since it does work, below is the rest of the setup. ​ So install should be a breeze with apt-get or aptitude, etc.
 +
 +==== Backup requirement ====
 +I plan on using dirvish to backup my Ubuntu box that has a main hard disk from which I boot, have o/s and everything else. The 2nd hard disk is my backup disk with mount point as /bak.  I also want to use this 2nd harddisk to backup my windows 7 laptop. My Ubuntu machine name is ub2. My Windows 7 laptop name is senthil_lt.
 +
 +==== Master configuration file ====
 +This file goes in /​etc/​dirvish/​master.conf on ub2
 +<​code>​
 +# Master configuration file
 +# For OS backup
 +
 +# Banks should be defined on different lines
 +bank:
 +        /bak
 +
 +# Don.t cross FS mount points
 +xdev: 1
 +
 +# Create index file and compress it
 +index: gzip
 +
 +# Log
 +log: text
 +
 +# Try to handle sparse files efficiently
 +sparse: 1
 +
 +# Secure (meta)-data
 +image-perm: 700
 +meta-perm: 600
 +
 +# Image name
 +image-default:​ %Y-%m-%d-%Hh
 +
 +# Default expiration time, keep images for 30 days
 +expire-default:​ +60 days
 +
 +# Expiration strategy
 +#​expire-rule:​
 +#        hr { 5-20 }                             +2 days
 +#        wd { 6 }                                +1 month
 +#        wd { 6 } md { 22-28 }                   +3 months
 +#        wd { 6 } md { 22-28 } mo { 6 }          +12 months
 +#        wd { 6 } md { 22-28 } mo { 12 }         never
 +
 +Runall:
 +        ub2
 +        senthil_lt_cdrive
 +        senthil_lt_ddrive
 +</​code>​
 +
 +==== Backing up local system - ub2 ====
 +We would need to setup the Vault configuration file. Hence, the 1st vault is to back up the local system on a 2nd hard disk. The /bak is a 2nd hard disk partition. Going with the settings above create a directory /​bak/​ub2/​dirvish.
 +
 +Create a configuration file default.conf under default.conf as follows:
 +<​code>​
 +client: ub2
 +tree: /
 +xdev: true
 +exclude:
 +    /bak
 +    /cdrom
 +    /dev
 +    /lost+found
 +    /media
 +    /mnt
 +    /selinux
 +    /srv
 +    /sys
 +    /tmp
 +</​code>​
 +
 +Then run the command to do the 1st backup and initialize the valut for ub2. Puttint ub2 in the client name (which is the actual hostname of the machine) helps to do a direct filesystem copy without invoking the network.
 +<​code>​
 +dirvish --vault ub2 --init
 +</​code>​
 +
 +==== Backing up the windows laptop ====
 +The 1st requirment is to have a rsync deamon running on windows so dirvish can communicate and download the required files. Follow the link [[http://​www.dirvish.org/​StevesWindowsGuide/​Windows_Dirvish_Guide.html|Setting up Windows as a Dirvish client]] to get that going. Once cwrsync is setup, you will need to configure the rsyncd.conf file. Below is the file I have setup:
 +<​code>​
 +use chroot = false
 +#gid = users
 +uid = 0
 +gid = 0
 +strict modes = false
 +#hosts allow = *
 +hosts allow = ub2
 +log file = rsyncd.log
 +log format = %h %o %f %l %b
 +pid file = rsyncd.pid
 +# Module definitions
 +# Remember cygwin naming conventions : c:\work becomes /​cygwin/​c/​work
 +#
 +[testdrive]
 +path = /​cygdrive/​c/​junk
 +read only = true
 +transfer logging = yes
 +#
 +[cdrive]
 +path = /cygdrive/c
 +read only = true
 +transfer logging = yes
 +#
 +[ddrive]
 +path = /cygdrive/d
 +read only = true
 +transfer logging = yes
 +</​code>​
 +
 +The next step is to setup the vaults on ub2 for the corresponding C & D drive backups.
 +
 +=== C Drive backup ===
 +Create directory: /​bak/​senthil_lt_cdrive/​dirvish. ​ Create a default.conf file inside that directory as follows:
 +<​code>​
 +client: senthil_lt
 +tree: :cdrive
 +xdev: true
 +</​code>​
 +Notice the **:** before **cdrive**. Without the **:** there will be an attempt to do rsynch over ssh and have a failure on port 22 if rsync over ssh is not configured.
 +
 +Now run: dirvish --vault senthil_lt_cdrive --init
 +
 +=== D Drive backup ===
 +Create directory: /​bak/​senthil_lt_ddrive/​dirvish. ​ Create a default.conf file inside that directory as follows:
 +<​code>​
 +client: senthil_lt
 +tree: :ddrive
 +xdev: true
 +</​code>​
 +
 +Now run: dirvish --vault senthil_lt_ddrive --init
 +
 +===== Resources =====
 +Below is the list of website links to help with installing, configuring and using Dirvish
 +
 +[[http://​www.dirvish.org/​|Main Divish Official website]]\\
 +[[http://​wiki.edseek.com/​howto:​dirvish|Dirvish Guide by Jason Boxman]]\\
 +[[http://​www.dirvish.org/​StevesWindowsGuide/​Windows_Dirvish_Guide.html|Setting up Windows as a Dirvish client]]\\
 +[[http://​manpages.ubuntu.com/​manpages/​hardy/​man5/​dirvish.conf.5.html|Ubuntu Manpage dirvish.conf - dirvish configuration file]]\\
 +==== Other Resources ====
 +[[http://​mo.morsi.org/​blog/​node/​231|Backups Via Dirvish ​ Morsi dot Org]]\\
 +[[http://​googlux.com/​dirvishconfig.html|dirvish - script and config]]\\
 +[[http://​www.cbrown.us/​2010/​06/​17/​backup-server-with-ubuntu-and-dirvish/​|Backup Server with Ubuntu and Dirvish CBrown.us]]\\
 +[[http://​www.tinkergeek.com/?​p=137|Dirvish - A Blog]]\\
 +
  

QR Code
QR Code tech:others:backups_with_dirvish (generated for current page)