Changes

From SME Server
Jump to navigationJump to search
8,834 bytes added ,  23:19, 15 March 2020
no edit summary
Line 4: Line 4:     
[http://dar.linux.free.fr/ DAR homepage]
 
[http://dar.linux.free.fr/ DAR homepage]
 +
 +
{{Note box|'''Important''' - Be aware of the concepts and issues as described in this section https://wiki.contribs.org/Backup_server_config#Backup_and_Restore_concepts.2C_issues_and_other_information}}
    
===Typical scenarios===
 
===Typical scenarios===
Line 11: Line 13:  
====Windows Share====
 
====Windows Share====
   −
With Windows workstations backing up to a removable or shared 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.
+
With Server backing up to a removable or shared 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.
    
  Backup is enabled.
 
  Backup is enabled.
Line 23: Line 25:  
  Daily backup occurs at 20:00
 
  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
 
  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  
+
  Full backup session (new backup sets) is allowed only on Friday
    
====USB Disk attached to Server====
 
====USB Disk attached to Server====
Line 37: Line 39:  
  Each daily backup session is cleanly timed out after 8 hours.
 
  Each daily backup session is cleanly timed out after 8 hours.
 
  Full backup sessions (new backup set) are allowed everyday
 
  Full backup sessions (new backup set) are allowed everyday
 +
 +
 +
====More common scenarios & explanation of backup selection settings====
 +
 +
Here are some typical scenarios, keep in mind the choice of full backup on a specified day or every day will also interact with these settings.
 +
 +
 +
If you wanted to do a full backup every day, & only retain 1 historical backup, then select
 +
 +
Number of daily backups contained in each set is 1.
 +
 +
Number of rotating backup sets is 1.
 +
 +
 +
If you wanted to do a full backup once every 7 days, then daily incremental backups every other day, & only retain 1 historical backup, select
 +
 +
Number of daily backups contained in each set is 7.
 +
 +
Number of rotating backup sets is 1.
 +
 +
 +
If you wanted to do a full backup once every 14 days, then daily incremental backups every other day, & only retain 1 historical backup, select
 +
 +
Number of daily backups contained in each set is 14.
 +
 +
Number of rotating backup sets is 1.
 +
 +
 +
If you wanted to do a full backup once every 28 days, then daily incremental backups every other day, & only retain 1 historical backup, select
 +
 +
Number of daily backups contained in each set is 28.
 +
 +
Number of rotating backup sets is 1.
 +
 +
 +
For any of the above, if you want to retain more historical backup sets, then change the
 +
 +
Number of rotating backup sets to 2 or 3 or 4 as desired
 +
 +
 +
So let's say the full backup is set to run on Friday only, & the backup time is set for 11pm.
 +
 +
On the first Friday night at 11pm a full backup is done, this may take many hours or even time out if there is a lot of data to backup.
 +
 +
On the first Saturday night at 11pm if the full backup did not complete the night before (timed out as per time out setting or reached 24 hours run time), then the full backup is continued on from where it left off.
 +
 +
If the full backup did complete, then an incremental backup is done, so only the additions & changes of data are added to the first full backup.
 +
 +
These are added as incremental backups, in a seperate incremental backup file with a date identifier.
 +
 +
Then every day of the backup period (being the Number of daily backups contained in each set), ie 7, 14 or 28 days, an incremental backup is done.
 +
 +
Then on the Friday (being either day 8, 15 or 29 in examples above) at 11pm a new full backup is done.
 +
 +
After that incremental backups are done each day, & so the cycle continues on.
 +
 +
 +
Note, when a full backup is done:
 +
 +
If Number of rotating backup sets is set to 1, then the original (first) backup is deleted.
 +
 +
If Number of rotating backup sets is set to 2, then the original (first) backup set is retained & a new backup set is created/started.
 +
 +
If Number of rotating backup sets is set to 3, then the first & second backup sets are retained & a new backup set is created/started.
 +
 +
If Number of rotating backup sets is set to 4, then the first, second & third backup sets are retained & a new backup set is created/started.
 +
 +
.... & so on.
 +
 +
Note that if a full restore is needed, the full & incremental backups are used, so all data is restored.
 +
 +
 +
A "practical" backup approach may be to configure for a Full backup every 7 days & daily incremental backups in between, with 2 rotating sets, so a new full backup is created each Friday & you retain a complete 7 days worth of backups for historical purposes.
 +
 +
You could even extend that to retaining 4 sets of historical backups, in case you wanted to restore some individual files from 25 days ago.
 +
 +
Another approach is to have 2 backup USB disks, & swap the disk every Friday (during the day) so the new full backup (on Friday night) is done to the alternate USB drive, and that alternate drive is used for the rest of the 7 days period for daily incremental backups.
 +
 +
How often you want to create a full backup & how many daily incrementals you want to have in a set & how many historical sets & whether you swap disks off site etc, is really a part of your overall backup protocol or strategy for the site/server in question.
    
===Backup Sets===
 
===Backup Sets===
Line 48: Line 129:  
each set".
 
each set".
   −
if you want a fixed number of increments in each set, then choose "Full backup
+
If you want a fixed number of increments, less than a multiple of 7, in each set, then choose "Full backup
is allowed on" = Anyday.
+
is allowed on" = Everyday. eg Daily backups in each set = 6 will result in 1 Full backup and 5 incremental backups, on each full backup all backups are deleted including the incrementals.
    +
 +
The above descriptions can relate to unusual combination of settings, where the number of incrementals does not match or equate to the full backup period.
 +
It is probably simpler to use (& to understand) setting values that are relative to each other eg weekly (7 day) full backup with 7 incrementals.
    
===Backup timeouts explained===
 
===Backup timeouts explained===
Line 106: Line 190:     
Create the deletion script
 
Create the deletion script
  pico -w /opt/scripts/deletebkp1
+
  nano -w /opt/scripts/deletebkp1
    
Enter the following (using your share name, user, pasword & domain)
 
Enter the following (using your share name, user, pasword & domain)
Line 120: Line 204:     
Create the cron job
 
Create the cron job
  pico -w /etc/cron.d/deletebkp1
+
  nano -w /etc/cron.d/deletebkp1
    
Enter the following (setting the time & day to be just before your scheduled backup time), see below.
 
Enter the following (setting the time & day to be just before your scheduled backup time), see below.
Line 146: Line 230:  
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).
 
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
+
Set the Slice size in the config DB
mkdir -p /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf
+
  config setprop backupwk Slice 1529M
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
 
Then expand the template with
 
  expand-template /etc/dar/DailyBackup.dcf
 
  expand-template /etc/dar/DailyBackup.dcf
      
The next time the backup runs, the resultant backup file will be split into 1.529Gb part sizes.
 
The next time the backup runs, the resultant backup file will be split into 1.529Gb part sizes.
      
===Adding/Excluding Directories and Files from the backup list===
 
===Adding/Excluding Directories and Files from the backup list===
Line 182: Line 249:  
  mkdir -p /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf
 
  mkdir -p /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf
 
   
 
   
  pico -w /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf/41go-into
+
  nano -w /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf/41go-into
 
   
 
   
 
  --go-into opt
 
  --go-into opt
Line 190: Line 257:       −
Check your backup (eg using the mc dar plugin) to see that /opt is now included.
+
Check your backup (eg using the [[Midnight Commander plugin for DAR|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.
 
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.
 
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.
Line 206: Line 273:  
Create custom template fragment to exclude the unneeded files and directories
 
Create custom template fragment to exclude the unneeded files and directories
 
   mkdir -p /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf
 
   mkdir -p /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf
   pico -w /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf/45prune
+
   nano -w /etc/e-smith/templates-custom/etc/dar/DailyBackup.dcf/45prune
 
    
 
    
 
   --prune home/e-smith/files/ibays/mirror/cgi-bin
 
   --prune home/e-smith/files/ibays/mirror/cgi-bin
Line 223: Line 290:  
   --prune path/to/dir/sampleDirName
 
   --prune path/to/dir/sampleDirName
 
}}
 
}}
 +
 +
===Use WOL to power on Workstation===
 +
{{Note box|This is a new feature and not implimented in SME 8.0. It will be available from SME 8.1}}
 +
Wake On Lan can be used to power up the backup target workstation before starting the backup.
 +
 +
To use WOL there simply needs to be a new variable added to the backupwk section of the configuration database, nothing else is required. This variable holds the MAC address of the target workstation, if the MAC address is 00:4E:89:F5:FD:2B use:
 +
 +
db configuration setprop backupwk SmbHostMAC 00:4E:89:F5:FD:2B
 +
 +
There is also the ability to specify how long to wait between the WOL packet being sent and attempting to start the backup process. The default wait time is 300 seconds, this can be varied via another configuration database setting. It is recommended to not set the wait period below 300 seconds. To set the wait time to 600 seconds:
 +
 +
db configuration setprop backupwk SmbHostDelay 600
 +
 +
The target system must support, and be set up to respond to, the WOL "magic packets". The network infrastructure must also support WOL packets. WOL should work across the local network without problem. WOL packets are not routeable so it won't work across the internet without additional support from hardware and/or software such as a VPN tunnel. Getting WOL to work across the internet is beyond the scope of this documentation but there are plenty of resources available elsewhere. Most wireless connected devices do not work with WOL.
 +
 +
Note that there is no checking that the supplied MAC address is the correct one for the IP address/hostname of the target workstation. MAC address's are effectively static but IP address's/hostnames can change particularly if the target gets its IP address via DHCP. It is quite possible to have the correct target woken up and be ready but the backup to fail because the IP address has changed. However SME's DHCP server very rarely changes the IP address of a given MAC address.
 +
 +
To stop using WOL simply delete the SmbHostMAC variable:
 +
 +
db configuration delprop backupwk SmbHostMAC
 +
 +
and to be tidy if the optional delay parameter has been set:
 +
 +
  db configuration delprop backupwk SmbHostDelay
 +
 +
===How to start a one-off backup===
 +
 +
To backup up to workstation as a one-off, not a scheduled event, run
 +
 +
/sbin/e-smith/do_backupwk
 +
 +
However note that scheduled backups must be enabled for the above command to work.
    
== Some notes ==
 
== Some notes ==
Line 229: Line 328:  
=== Backup file slices are NOT autonomous ===
 
=== Backup file slices are NOT autonomous ===
 
The catalogue of the contents of the backup is put in the last slice. If for some reason the last slice can not be written (e.g. backup medium is full or network failure), is lost or corrupt, the slices already saved are useless.
 
The catalogue of the contents of the backup is put in the last slice. If for some reason the last slice can not be written (e.g. backup medium is full or network failure), is lost or corrupt, the slices already saved are useless.
      
=== Naming of the backups on the workstation share or USB disk ===
 
=== Naming of the backups on the workstation share or USB disk ===
Line 268: Line 366:     
Save the file.
 
Save the file.
 +
 +
== Manually restoring from dar archive created by e-smith-backup ==
 +
 +
Restores can be done for:
 +
 +
-the entire system.
 +
 +
-a selected file only.
 +
 +
-a selected directory and all of its contents.
 +
 +
The entire system and a selected file only can be done through the server-manager.
 +
 +
The selected directory can be done via shell.
 +
(You will have to adjust for your particular situation.)
 +
 +
First, MOUNT THE BACKUP DRIVE (if required):
 +
mount /dev/sdc1 /media/BackupDrive1/
 +
 +
You can mount the configured CIFS/SMB destination using<syntaxhighlight lang="bash" >
 +
mount -t cifs //$(config getprop backupwk SmbHost)/$(config getprop backupwk SmbShare) $(config getprop backupwk Mount) -o credentials=/etc/dar/CIFScredentials
 +
</syntaxhighlight>List available backups<syntaxhighlight  lang="bash" >
 +
find $(config getprop backupwk Mount)/$(config get SystemName).$(config get DomainName) -name "*.1.dar" | sed s/\.1\.dar$//
 +
</syntaxhighlight>
 +
 +
Then, RESTORE THE DIRECTORY:
 +
dar -x /media/BackupDrive1/server.domain.local/set2/full-201408092200 -N -R ./ -w -g home/e-smith/files/ibays/share_data/files
 +
 +
This will restore the directory /home/e-smith/files/ibays/share_data/files to you current directory. If your current directory is /tmp/, the files will be recovered to /tmp/home/e-smith/files/ibays/share_data/files. This will make you able to search through the recovered files and, if needed, move them to their proper location.
 +
 +
{{Warning box|Be sure to use -R ./ (the dot) to restore in the current dir, otherwise you'll restore files/dirs in their original path}}
 +
 +
You may also have to RESTORE ANY INCREMENTS:
 +
dar -x /media/BackupDrive1/server.domain.local/set2/inc-001-201408102200.1.dar -N -R ./ -w -g home/e-smith/files/ibays/share_data/files
 +
dar -x /media/BackupDrive1/server.domain.local/set2/inc-002-201408112200.1.dar -N -R ./ -w -g home/e-smith/files/ibays/share_data/files
 +
dar -x /media/BackupDrive1/server.domain.local/set2/inc-003-201408122200.1.dar -N -R ./ -w -g home/e-smith/files/ibays/share_data/files
 +
dar -x /media/BackupDrive1/server.domain.local/set2/inc-004-201408132200.1.dar -N -R ./ -w -g home/e-smith/files/ibays/share_data/files
 +
 +
{{Note box|Unmount the backup destination after any manual exploration:
 +
  umount $(config getprop backupwk Mount)}}
 
----
 
----
[[Category:Contrib]]
+
 
 
[[Category: Backup]]
 
[[Category: Backup]]
 +
[[Category:Howto]]
Super Admin, Wiki & Docs Team, Bureaucrats, Interface administrators, Administrators
3,228

edits

Navigation menu