Difference between revisions of "Backup with dar"

From SME Server
Jump to navigationJump to search
(outdated info removed)
(info moved to manual)
Line 3: Line 3:
 
[http://dar.linux.free.fr/ DAR homepage]
 
[http://dar.linux.free.fr/ DAR homepage]
  
===Detailed Information===
+
===Backup disk size limits workaround===
 
 
====What is e-smith-backup with dar ?====
 
 
 
e-smith-backup with dar is an upgrade of e-smith-backup sme core rpm which provides panels for daily full or incremental backup on LAN workstation (via nfs or cifs) or local usb disk, and full or selective restore  with use of dar program.
 
 
 
====Are new functions provided ?====
 
 
 
Yes. Aside use of session timeout, the first is incremental backup.
 
This means that you can backup and restore data for the period of time you want : one day, three days, one week, one month, 100 days... and restore your system at any state it was during this period of time. This probably has no utility to do full restore of the system as it was one month ago, but restoring a file lost by a user two or three weeks ago can be useful. And restoring a safe system more than one day old can be needed.
 
 
 
The second function is keeping more than one set of backup (a set is full backup data and all datas of next daily incremental backups) with automatic rotation. e.g. you can do only nightly full backups but keep three sets of backup for security reason  (as being able to restore the system as it was 72h ago).
 
 
 
The third function is selective restore of any saved file or directory, exactly as it was for any of the saved days in your sets. Not only you can restore a lost file at it's last state, but also say : make restore of the most recent version of the file before this given date... Selective restore is not an easy thing to manage by hand, and providing this in a simple way with panels is useful. Dar permits to manage selective restore and e-smith-backup with dar panels tries to keep this function as simple as possible to use.
 
 
 
===Practical setup tips===
 
 
 
====Typical settings====
 
 
 
Change these to suit your particular situation.
 
 
 
In a typical scenario with Windows workstations backing up to a removable or attached drive in a workstation, with a weekly full backup on Friday and subsequent daily incremental backups & you wish to retain 2 backup sets on each disk, with backup to start at 8pm and finish at 8am, use the following settings.
 
 
 
Backup is enabled.
 
 
 
Backup is made on LAN workstation netshare via smbfs
 
 
 
Destination backup share folder is backup
 
 
 
Login is backupuser
 
 
 
Password is ********
 
 
 
Number of rotating backup sets is 2
 
 
 
Number of daily backups contained in each set is 7
 
 
 
Compression level (0-7) of backup is 4
 
 
 
Daily backup occurs at 20:00
 
 
 
Each daily backup session is cleanly timed out after 12h except full backups which are cleanly timed out after 24 hours
 
 
 
Full backup session (new backup sets) is allowed only on Friday
 
 
 
 
 
====Backup disk size limits workaround====
 
  
 
If having issues with the size of removable backup disks (eg 120Gb IDE on a workstation) versus the resultant backup data size (eg 120Gb of data compressing to approx 50Gb), then you can manually setup a cron job to delete the old backup file(s) before saving the new backup file(s).
 
If having issues with the size of removable backup disks (eg 120Gb IDE on a workstation) versus the resultant backup data size (eg 120Gb of data compressing to approx 50Gb), then you can manually setup a cron job to delete the old backup file(s) before saving the new backup file(s).
Line 95: Line 49:
 
  50  1    *    *    6    root  . /opt/scripts/deletebkp1
 
  50  1    *    *    6    root  . /opt/scripts/deletebkp1
  
====Howto set the backup file slice size====
+
===Howto set the backup file slice size===
  
 
The default slice or part setting is 700Mb (to suit CD's).
 
The default slice or part setting is 700Mb (to suit CD's).
Line 125: Line 79:
  
  
====Adding Directories and Files to the list of backup inclusions====
+
===Adding Directories and Files to the list of backup inclusions===
  
 
{{Warning box|The e-smith-backup panel is designed to be used as a full disaster recovery backup & restore method for your sme server, and as such relies on the correct directories being included in the backup. Do not delete any of the default directories from 40go-into as these are all essential for a successful full Restore of your backup to a clean install of the sme server operating system (you will need to reinstall add on apps or contribs). You can safely add directories eg /opt, as indicated, but that should typically be the extent of changes made.}}
 
{{Warning box|The e-smith-backup panel is designed to be used as a full disaster recovery backup & restore method for your sme server, and as such relies on the correct directories being included in the backup. Do not delete any of the default directories from 40go-into as these are all essential for a successful full Restore of your backup to a clean install of the sme server operating system (you will need to reinstall add on apps or contribs). You can safely add directories eg /opt, as indicated, but that should typically be the extent of changes made.}}

Revision as of 00:42, 10 December 2008

Backup with dar using e-smith-backup

DAR homepage

Backup disk size limits workaround

If having issues with the size of removable backup disks (eg 120Gb IDE on a workstation) versus the resultant backup data size (eg 120Gb of data compressing to approx 50Gb), then you can manually setup a cron job to delete the old backup file(s) before saving the new backup file(s).

The specific issue experienced was being able to get one full backup onto a disk, and a weeks worth of daily incrementals, but the next weekly full backup failed, due to the need to save the new backup in the tmp folder on the removable disk, before deleting the old backup files. There was not enough space on the disk (size) being used.

To workaround this, create a cron job and put it in /etc/cron.d with a script in /opt/scripts/XXX, which mounts the drive and deletes the old backup just before the new full backup commences. This will delete the old backup before the new backup commences, which is different to how the backup is designed to work by default. It is necessary to forgo the security of retaining the old backup until the new one has completed, in order to use the available hardware (smaller disk).


Create the deletion script

pico -w /opt/scripts/deletebkp1

Enter the following (using your share name, user, pasword & domain)

umount /mnt/smb
/bin/mount -t cifs //stationXX/bkp1 /mnt/smb -o username=XXXXXX,password=XXXXXXXXXXXXX
rm -f -R /mnt/smb/servername.yourdomain.com/
rm -f -R /mnt/smb/tmp_dir/

Then save & exit

Ctrl o
Ctrl x


Create the cron job

pico -w /etc/cron.d/deletebkp1

Enter the following (setting the time & day to be just before your scheduled backup time), see below. The following values suit a scheduled full backup for 2.00am on Saturday morning (ie Friday evening), where the old backup gets deleted at 1:50am

50    1   *    *   6    root   . /opt/scripts/deletebkp1

Then save & exit

Ctrl o
Ctrl x


Cron entries format is as follows:

+-----------------------Minute            (0-59)
|    +-------------------Hour of Day      (0-23)
|    |    +---------------Day of Month    (1-31)
|    |    |    +-----------Month of Year  (1-12)
|    |    |    |    +-------Day of Week   (0=Sun,6=Sat)
 
50   1    *    *    6    root   . /opt/scripts/deletebkp1

Howto set the backup file slice size

The default slice or part setting is 700Mb (to suit CD's). The slice size can be changed for example to suit 4.7Gb DVD's, by making 3 parts fit on to a DVD, so the required slice size is 1529Mb (allowing for overheads & real data size).

Create the custom template fragment

mkdir -p /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf
cp /etc/e-smith/templates/etc/dar/DailyBackup.dcf/90slice /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf

(the above cp command is all on one line)

Modify the file size & save

pico -w /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf/90slice

Edit it to read like this

{
($backupwk{Slice} || '1529M') eq '1529M' ?  "--slice 1529M\n" : "--slice $backup
}

Then save & exit

Ctrl o
Ctrl x

Then expand the template with

expand-template /etc/dar/DailyBackup.dcf


The next time the backup runs, the resultant backup file will be split into 1.529Gb part sizes.


Adding Directories and Files to the list of backup inclusions

Warning.png Warning:
The e-smith-backup panel is designed to be used as a full disaster recovery backup & restore method for your sme server, and as such relies on the correct directories being included in the backup. Do not delete any of the default directories from 40go-into as these are all essential for a successful full Restore of your backup to a clean install of the sme server operating system (you will need to reinstall add on apps or contribs). You can safely add directories eg /opt, as indicated, but that should typically be the extent of changes made.


The default backup does not include /opt

To add /opt to the backup inclusion list, create a custom template fragment and add opt to the list.

Create custom template fragment to add needed files and directories

mkdir -p /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf

pico -w /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf/41go-into

--go-into opt

Then expand the template

expand-template /etc/dar/DailyBackup.dcf


Check your backup (eg using the mc dar plugin) to see that /opt is now included. It is also prudent to do a test full restore and verify that /opt (& all other backed up directories & files) are restored, as anticipated. If something is wrong with your backup or restore procedures, then required files may not be backed up and restored, so it is wise to do a test full backup & restore to fully prove your procedures are working correctly.