Changes

From SME Server
Jump to navigationJump to search
1,367 bytes removed ,  10:01, 13 November 2007
Removed all unneccesarry html mumble jumble to make the source more readable
Line 1: Line 1: −
<span style='font-size:150%'>Automated Remote Disk Archiver for SME 7 Server</span>
   
=== Maintainer ===
 
=== Maintainer ===
 
Michael Weinberger
 
Michael Weinberger
    
Affa was contributed on [http://forums.contribs.org/index.php?topic=36499.0 Thu Apr 05, 2007]
 
Affa was contributed on [http://forums.contribs.org/index.php?topic=36499.0 Thu Apr 05, 2007]
  −
      
=== Description ===
 
=== Description ===
Line 17: Line 14:     
Affa is a command line tool for system administrators and is intentionally designd without a GUI. Therefore it can be efficiently managed on the console and over slow internet connections.
 
Affa is a command line tool for system administrators and is intentionally designd without a GUI. Therefore it can be efficiently managed on the console and over slow internet connections.
  −
      
==== Affa features at a glance ====
 
==== Affa features at a glance ====
Line 51: Line 46:  
* Logs in /var/log/affa with optional debug switch for more verbosity
 
* Logs in /var/log/affa with optional debug switch for more verbosity
 
* Log files are rotated weekly, with 5 logs kept
 
* Log files are rotated weekly, with 5 logs kept
  −
      
=== Download and Installation ===
 
=== Download and Installation ===
Line 66: Line 59:  
Set up a second SME 7 box as your backupserver with hostname 'affabox‘ and IP 10.200.48.2.  
 
Set up a second SME 7 box as your backupserver with hostname 'affabox‘ and IP 10.200.48.2.  
   −
# log into the 'affabox' and install the packages as described above.
+
<ol></li><li>log into the 'affabox' and install the packages as described above.
# copy the config helper script sample<br><code># cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl </code>
+
</li><li>copy the config helper script sample
# edit /root/prodbox-job.pl and set<br><code>my $jobname='prodbox';</code><br>and<br><code>'remoteHostName‘=>'10.200.48.1',</code>
+
cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl
# write the configuration (this makes the database entries and sets up the cronjobs)<br><code># /root/prodbox-job.pl</code><br>
+
</li><li>edit /root/prodbox-job.pl and set
# generate the DSA keys and send the public key to the 'prodbox'<br><code># affa --send-key prodbox</code>
+
my $jobname='prodbox';
# run the job manually<br><code># affa --run prodbox</code>
+
and
 +
'remoteHostName‘=>'10.200.48.1',
 +
</li><li>write the configuration (this makes the database entries and sets up the cronjobs)
 +
/root/prodbox-job.pl
 +
</li><li>generate the DSA keys and send the public key to the 'prodbox'
 +
affa --send-key prodbox
 +
</li><li>run the job manually
    +
affa --run prodbox</li></ol>
    
=== Configuration ===
 
=== Configuration ===
 
The configuration is stored in an e-smith style database. Use the db command to configure Affa.
 
The configuration is stored in an e-smith style database. Use the db command to configure Affa.
 
The jobname is the record key with the type 'job'.<br>To setup a new job with the name 'prodbox' enter:
 
The jobname is the record key with the type 'job'.<br>To setup a new job with the name 'prodbox' enter:
<br><code># db affa set prodbox job</code><br>
+
 
then set the properties<br>
+
db affa set prodbox job
<code># db affa setprop prodbox remoteHostName 192.168.1.1</code><br>
+
 
<code># db affa setprop prodbox TimeSchedule '0030,0730,1130,1330,1730,2030'</code><br>
+
then set the properties
<code># db affa setprop prodbox Description 'My Production Server'</code><br>
+
 
<code># db affa setprop prodbox status enable</code><br>
+
db affa setprop prodbox remoteHostName 192.168.1.1
 +
db affa setprop prodbox TimeSchedule '0030,0730,1130,1330,1730,2030'
 +
db affa setprop prodbox Description 'My Production Server'
 +
db affa setprop prodbox status enable
 
and so on...
 
and so on...
    
Alternatively you can you use a script as described above in the 'Quick start' chapter.
 
Alternatively you can you use a script as described above in the 'Quick start' chapter.
   −
To verify your work, type:<br>
+
To verify your work, type:
<code># db affa show prodbox</code>
  −
 
  −
Finally set up the cronjobs:<br>
  −
<code># affa --make-cronjobs</code>
      +
db affa show prodbox
    +
Finally set up the cronjobs:
 +
affa --make-cronjobs
    
==== Job configuration properties ====
 
==== Job configuration properties ====
Line 185: Line 187:     
==== Default configuration properties ====
 
==== Default configuration properties ====
All properties can be set as defaults in the DefaultAffaConfig record. This is useful, when you set up many similar jobs.<br>
+
All properties can be set as defaults in the DefaultAffaConfig record. This is useful, when you set up many similar jobs.  
Example: You want to set the property 'localNice' to 19 for all jobs. Then run<br>
+
Example: You want to set the property 'localNice' to 19 for all jobs. Then run
<code># db affa setprop DefaultAffaConfig localNice 19</code><br>
+
db affa setprop DefaultAffaConfig localNice 19
and don't set this property for the jobs.<br>
+
and don't set this property for the jobs.
Properties set in the job record overrides the defaults.<br>
+
Properties set in the job record overrides the defaults.
   −
The special property 'sendStatus' is only applicable to the DefaultAffaConfig record. It controls the status report sent by email and can be set to the values 'none', 'daily', 'weekly' or 'monthly'. To setup a weekly status report run:<br>
+
The special property 'sendStatus' is only applicable to the DefaultAffaConfig record. It controls the status report sent by email and can be set to the values 'none', 'daily', 'weekly' or 'monthly'. To setup a weekly status report run:
<code># db affa setprop DefaultAffaConfig sendStatus weekly</code><br>
+
db affa setprop DefaultAffaConfig sendStatus weekly
then setup the cronjob:<br>
+
then setup the cronjob:
<code># affa --make-cronjobs</code>
+
affa --make-cronjobs
    
==== Global disable ====
 
==== Global disable ====
All jobs can be disabled with setting the AffaGlobalDisable record type to 'yes'.<br>
+
All jobs can be disabled with setting the AffaGlobalDisable record type to 'yes'.
<code># db affa set AffaGlobalDisable yes</code><br>
+
db affa set AffaGlobalDisable yes
<code># affa --make-cronjobs</code>
+
affa --make-cronjobs
 
  −
to re-enable run:<br>
  −
<code># db affa set AffaGlobalDisable no</code><br>
  −
<code># affa --make-cronjobs</code>
  −
 
      +
to re-enable run:
 +
db affa set AffaGlobalDisable no
 +
affa --make-cronjobs
    
=== Usage and command line options ===
 
=== Usage and command line options ===
<code><b>affa --run JOB</b></code><br>
+
affa --run JOB
 
Starts a job run. Usually done by the cronjob.  
 
Starts a job run. Usually done by the cronjob.  
   −
<code><b>affa --make-cronjobs</b></code><br>
+
affa --make-cronjobs
 
Configures the cronjobs as scheduled in the jobs records.
 
Configures the cronjobs as scheduled in the jobs records.
   −
<code><b>affa --send-key JOB</b></code><br>
+
affa --send-key JOB
 
Sends the public key to the host 'remoteHostName' as configured in the record of job JOB. Generates the DSA key, if not already done.
 
Sends the public key to the host 'remoteHostName' as configured in the record of job JOB. Generates the DSA key, if not already done.
   −
<code><b>affa --send-key --host=TARGETHOST [--port=PORT]</b></code><br>
+
affa --send-key --host=TARGETHOST [--port=PORT]
 
Sends the public key to the TARGETHOST. TARGETHOST is a FQHN or an IP address. Give PORT, if sshd on the TARGETHOST listens to another than the standard port 22. Generates the DSA key, if not already done.
 
Sends the public key to the TARGETHOST. TARGETHOST is a FQHN or an IP address. Give PORT, if sshd on the TARGETHOST listens to another than the standard port 22. Generates the DSA key, if not already done.
    
Note: The --send-key option only works, if the public keys are stored in /root/.ssh/authorized_keys2 on the remote host. This is true for SME server.
 
Note: The --send-key option only works, if the public keys are stored in /root/.ssh/authorized_keys2 on the remote host. This is true for SME server.
   −
 
+
affa --full-restore JOB [ARCHIVE]
<code><b>affa --full-restore JOB [ARCHIVE]</b></code><br>
   
Does a full restore from the backup ARCHIVE on the remote source server as defined in the JOB record. If ARCHIVE is not given, the archive 'scheduled.0' is used as the default. The full restore reconstructs the server as it was at the time of the backup. After the restore the source host reboots.
 
Does a full restore from the backup ARCHIVE on the remote source server as defined in the JOB record. If ARCHIVE is not given, the archive 'scheduled.0' is used as the default. The full restore reconstructs the server as it was at the time of the backup. After the restore the source host reboots.
   −
<code><b>affa --rise JOB [ARCHIVE]</b></code><br>
+
affa --rise JOB [ARCHIVE]
 
Runs a full restore from the backup ARCHIVE on the Affa server <b>(!)</b> from the backup ARCHIVE of job JOB. In other words: After completion, the Affa box reboots as a clone of the source server. Ensure, that the source server has been powered off before you reboot the Affa box, otherwise the network interface will not come up. This is important, when you run --rise remotely. The --rise feature only works with SME 7 servers.
 
Runs a full restore from the backup ARCHIVE on the Affa server <b>(!)</b> from the backup ARCHIVE of job JOB. In other words: After completion, the Affa box reboots as a clone of the source server. Ensure, that the source server has been powered off before you reboot the Affa box, otherwise the network interface will not come up. This is important, when you run --rise remotely. The --rise feature only works with SME 7 servers.
   −
<code><b>affa --undo-rise</b></code><br>
+
affa --undo-rise
 
This feature reverts a risen Affa box to a backup server. After a reboot, all configured jobs will work again.
 
This feature reverts a risen Affa box to a backup server. After a reboot, all configured jobs will work again.
   −
<code><b>affa --list-archives [--csv] JOB</b></code><br>
+
affa --list-archives [--csv] JOB
 
Displays a table of all present archives of job JOB with date, number of files, size and disk usage. See chapter 'Restore' for an output example.
 
Displays a table of all present archives of job JOB with date, number of files, size and disk usage. See chapter 'Restore' for an output example.
 
With --csv, the output is in machine readable colon separared format.
 
With --csv, the output is in machine readable colon separared format.
   −
<code><b>affa --status [--csv]</b></code><br>
+
affa --status [--csv]
 
Displays a table of all configured jobs with enable status, time of last and next run, size, disk usage and the number of scheduled (s), daily (d), weekly (w), monthly (m) and yearly (y) archives. Last time shows 'failed', if a job did not run in the last 24h. For disabled jobs 'Last' always shows 'failed' after 24 h. To see the date and time of the last run of those jobs use the --list-archives option. Column 'Next' shows the time when the next run will be started, if 'Enabled' is 'yes'. Column 'Disk usage' shows the usage of the partion, where the RootDir of the job is located on. If all jobs are located in the same RootDir, identical disk usage is shown for all jobs. If RootDir is /var/affa, the usage of the SME server system partition is shown.
 
Displays a table of all configured jobs with enable status, time of last and next run, size, disk usage and the number of scheduled (s), daily (d), weekly (w), monthly (m) and yearly (y) archives. Last time shows 'failed', if a job did not run in the last 24h. For disabled jobs 'Last' always shows 'failed' after 24 h. To see the date and time of the last run of those jobs use the --list-archives option. Column 'Next' shows the time when the next run will be started, if 'Enabled' is 'yes'. Column 'Disk usage' shows the usage of the partion, where the RootDir of the job is located on. If all jobs are located in the same RootDir, identical disk usage is shown for all jobs. If RootDir is /var/affa, the usage of the SME server system partition is shown.
 
<small><pre>
 
<small><pre>
Line 264: Line 263:       −
<code><b>affa --send-status</b></code><br>
+
affa --send-status
 
Sends the status table to the email adresses configured in the 'DefaultAffaConfig' record. Used by the cronjob 'affa-status'.
 
Sends the status table to the email adresses configured in the 'DefaultAffaConfig' record. Used by the cronjob 'affa-status'.
   −
<code><b>affa --mailtest JOB</b></code><br>
+
affa --mailtest JOB
 
Sends a test email to the email adresses configured in the JOB record. With property Watchdog=yes, a test email is sent from the remote host, too. Use this to verify, that your mail processing is functional.<br>
 
Sends a test email to the email adresses configured in the JOB record. With property Watchdog=yes, a test email is sent from the remote host, too. Use this to verify, that your mail processing is functional.<br>
 
'''Note:''' By default Affa only sends messages on errors, never on success (see property chattyOnSuccess).
 
'''Note:''' By default Affa only sends messages on errors, never on success (see property chattyOnSuccess).
   −
<code><b>affa --cleanup JOB</b></code><br>
+
affa --cleanup JOB
 
After you have lowered a keep value, e.g. scheduledKeep, then archives with a higher indices will no longer be shifted and will exist for ever. This option finds these archives and deletes them.
 
After you have lowered a keep value, e.g. scheduledKeep, then archives with a higher indices will no longer be shifted and will exist for ever. This option finds these archives and deletes them.
   −
<code><b>affa --rename-job JOB NEWNAME</b></code><br>
+
affa --rename-job JOB NEWNAME
 
Renames the job JOB to NEWNAME including all database records and archive directories.
 
Renames the job JOB to NEWNAME including all database records and archive directories.
   −
<code><b>affa --move-archive JOB NEWROOTDIR</b></code><br>
+
affa --move-archive JOB NEWROOTDIR
 
Moves the archive directory of job JOB to the rootdir NEWROOTDIR and adjusts the property RootDir. NEWROOTDIR must be a full path starting with a slash. As moving across filesystems (e.g. from an external USB drive to the local disk) is not possible, Affa uses a copy command in this case and deletes the source directory after that. Depending on the archive size, copying across filesystems can take a long time.
 
Moves the archive directory of job JOB to the rootdir NEWROOTDIR and adjusts the property RootDir. NEWROOTDIR must be a full path starting with a slash. As moving across filesystems (e.g. from an external USB drive to the local disk) is not possible, Affa uses a copy command in this case and deletes the source directory after that. Depending on the archive size, copying across filesystems can take a long time.
   −
<code><b>affa --delete-job [--revoke-key] JOB</b></code><br>
+
affa --delete-job [--revoke-key] JOB
 
Irreversibly deletes a job including all archives, configuration and report databases. With given --revoke-key option, the public key on the remote server will be deleted.
 
Irreversibly deletes a job including all archives, configuration and report databases. With given --revoke-key option, the public key on the remote server will be deleted.
   −
<code><b>affa --revoke-key JOB</b></code><br>
+
affa --revoke-key JOB
<code><b>affa --revoke-key --host=TARGETHOST [--port=PORT]</b></code><br>
+
 
 +
affa --revoke-key --host=TARGETHOST [--port=PORT]
 
Deletes the public dsa key on the remote server.
 
Deletes the public dsa key on the remote server.
   Line 302: Line 302:  
==== Backup single ibays  ====
 
==== Backup single ibays  ====
 
Suppose you want to backup the ibays 'staff1' and 'staff2' on your production server with WAN IP 82.123.1.1  to an Affa server in a different location over the internet every night at 2:30am.
 
Suppose you want to backup the ibays 'staff1' and 'staff2' on your production server with WAN IP 82.123.1.1  to an Affa server in a different location over the internet every night at 2:30am.
# log into the Affa server and install the packages as described above.
+
<ol></li><li>log into the Affa server and install the packages as described above.
# copy the config helper script sample<br><code># cp /usr/lib/affa/jobconfig-sample.pl /root/ibay-staff-job.pl </code>
+
</li><li>copy the config helper script sample
# edit /root/ibay-staff-job.pl and set<br><code>my $jobname='ibay-staff';</code><br>and<br><code>'remoteHostName‘=>'82.123.1.1',</code><br><code>'TimeSchedule'=>'0230',</code><br><code>'SMEServer'=>'no',</code><br><code>'Include[0]'=>'/home/e-smith/files/ibays/staff1',</code><br><code>'Include[1]'=>'/home/e-smith/files/ibays/staff2',</code>
+
cp /usr/lib/affa/jobconfig-sample.pl /root/ibay-staff-job.pl
# write the configuration<br><code># /root/ibay-staff-job.pl</code>
+
</li><li>edit /root/ibay-staff-job.pl and set
# send the public key to the production server<br><code># affa --send-key ibay-staff</code>
+
my $jobname='ibay-staff';
# check next morning<br><code># affa --list-archives ibay-staff</code><br><code># affa --status</code><br><code># ls /var/affa/ibay-staff</code>
+
and
 +
'remoteHostName‘=>'82.123.1.1',
 +
'TimeSchedule'=>'0230',
 +
'SMEServer'=>'no',
 +
'Include[0]'=>'/home/e-smith/files/ibays/staff1',
 +
'Include[1]'=>'/home/e-smith/files/ibays/staff2',
 +
</li><li>write the configuration
 +
/root/ibay-staff-job.pl
 +
</li><li>send the public key to the production server
 +
affa --send-key ibay-staff</li><li>check next morning
 +
affa --list-archives ibay-staff
 +
affa --status
 +
ls /var/affa/ibay-staff</li></ol>
    
==== [Todo] Two production servers backup each other ====
 
==== [Todo] Two production servers backup each other ====
Line 318: Line 330:  
===== Setup NAS =====
 
===== Setup NAS =====
 
You have a [http://www.freenas.org FreeNAS] box with IP 10.200.48.2 up and running with NFS service enabled for your network 10.200.48.0/22. The RAID array is mounted to /mnt/affashare.
 
You have a [http://www.freenas.org FreeNAS] box with IP 10.200.48.2 up and running with NFS service enabled for your network 10.200.48.0/22. The RAID array is mounted to /mnt/affashare.
# log into the 'prodbox' and install the NFS packages<br><code>yum  --enablerepo=base install nfs-utils</code><br>You don't need to signal post-upgrade or reboot event.
+
<ol></li><li>log into the 'prodbox' and install the NFS packages
# mount the NFS share<br><code>mkdir -p /mnt/affadevice</code><br><code>mount 10.200.48.2:/mnt/affashare /mnt/affadevice</code>
+
yum  --enablerepo=base install nfs-utils
 
+
You don't need to signal post-upgrade or reboot event.
 +
</li><li>mount the NFS share
 +
mkdir -p /mnt/affadevice
 +
mount 10.200.48.2:/mnt/affashare  
 +
/mnt/affadevice</li></ol>
 
===== Alternatively setup a USB drive =====
 
===== Alternatively setup a USB drive =====
# log into the 'prodbox'  
+
<ol></li><li>log into the 'prodbox'  
# Connect a USB hard disk to the USB Bus. Now you must determine what device the kernel has assigned to the drive. View the /var/log/message and search for ''Initializing USB Mass Storage driver''. A few lines below you'll find the name of the device. In this example it is ''sdc''. Replace ''/dev/sdc'' by ''your device'' in following instructions.
+
</li><li>Connect a USB hard disk to the USB Bus. Now you must determine what device the kernel has assigned to the drive. View the /var/log/message and search for ''Initializing USB Mass Storage driver''. A few lines below you'll find the name of the device. In this example it is ''sdc''. Replace ''/dev/sdc'' by ''your device'' in following instructions.
# Use the fdisk program to create a linux partition<br><code># fdisk /dev/sdc</code><br>You'll most likely find an existing vfat dos partition, which you have to delete first. In the following we assume, that you have created a single partition ''/dev/sdc1''.
+
</li><li>Use the fdisk program to create a linux partition
# Now format the drive with an ext3 filesystem<br><code>mkfs.ext3 /dev/sdc1</code>
+
fdisk /dev/sdc
# Make the mount point<br><code># mkdir -p /mnt/affadevice</code>
+
You'll most likely find an existing vfat dos partition, which you have to delete first. In the following we assume, that you have created a single partition ''/dev/sdc1''.
# Add the following line to the /etc/fstab<br><code>/dev/sdc1 /mnt/affadevice ext3 defaults</code>
+
</li><li>Now format the drive with an ext3 filesystem
# Mount the drive<br><code>mount /mnt/affadevice</code>
+
mkfs.ext3 /dev/sdc1
# Crosscheck your work using the df command<br><code># df</code>
+
</li><li>Make the mount point
 
+
mkdir -p /mnt/affadevice
 +
</li><li>Add the following line to the /etc/fstab
 +
/dev/sdc1 /mnt/affadevice ext3 defaults
 +
</li><li>Mount the drive
 +
mount /mnt/affadevice
 +
</li><li>Crosscheck your work using the df command
 +
df
 +
</li></ol>
 
===== Setup Affa =====
 
===== Setup Affa =====
 
You want to run backups on 11:30 h, 15:30 h and 19:30 h and you want to keep the last 3 scheduled backups, 7 daily, 5 weekly, 12 monthly and 1 yearly backups.
 
You want to run backups on 11:30 h, 15:30 h and 19:30 h and you want to keep the last 3 scheduled backups, 7 daily, 5 weekly, 12 monthly and 1 yearly backups.
# log into the 'prodbox' and install the Affa packages as described above.
+
<ol></li><li>log into the 'prodbox' and install the Affa packages as described above.
# copy the config helper script sample<br><code># cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl </code>
+
</li><li>copy the config helper script sample
# edit /root/prodbox-job.pl and set<br><code>my $jobname='prodbox';</code><br>and<br><code>'remoteHostName‘=>'localhost',</code><br><code>'TimeSchedule'=>'1130,1530,1930',</code><br><code>'scheduledKeep'=>3,</code><br><code>'dailyKeep'=>7,</code><br><code>'weeklyKeep'=>5,</code><br><code>'monthlyKeep'=>12,</code><br><code>'yearlyKeep'=>1,</code><br><code>'RootDir=>'/mnt/affadevice',</code><br>Review the other properties and change them to your needs.
+
cp /usr/lib/affa/jobconfig-sample.pl /root/prodbox-job.pl
# write the configuration<br><code># /root/prodbox-job.pl</code>
+
</li><li>edit /root/prodbox-job.pl and set
# run the job manually<br><code># affa --run prodbox</code>
+
my $jobname='prodbox';
 +
and
 +
'remoteHostName‘=>'localhost',
 +
'TimeSchedule'=>'1130,1530,1930',
 +
'scheduledKeep'=>3,
 +
'dailyKeep'=>7,
 +
'weeklyKeep'=>5,
 +
'monthlyKeep'=>12,
 +
'yearlyKeep'=>1,
 +
'RootDir=>'/mnt/affadevice',
 +
Review the other properties and change them to your needs.
 +
</li><li>write the configuration
 +
/root/prodbox-job.pl
 +
</li><li>run the job manually
 +
 
 +
affa --run prodbox</li></ol>
    
===== Limitations =====
 
===== Limitations =====
Line 343: Line 381:     
===== Automount =====
 
===== Automount =====
Having the backup archives in the same filesystem is always a risk, which can be minimized by using the automount feature. Then the external filesystem is only mounted during a job run. <br>
+
Having the backup archives in the same filesystem is always a risk, which can be minimized by using the automount feature. Then the external filesystem is only mounted during a job run.
   −
In the NAS example set<br>
+
In the NAS example set
<code>'AutomountDevice=>'10.200.48.2:/mnt/affashare',</code><br><code>'AutomountPoint =>'mnt/affadevice',</code><br>and skip the step 2.
+
'AutomountDevice=>'10.200.48.2:/mnt/affashare',
 +
'AutomountPoint =>'mnt/affadevice',
 +
and skip the step 2.
   −
In the USB drive example set<br>
+
In the USB drive example set
<code>'AutomountDevice=>'/dev/sdc1',</code><br><code>'AutomountPoint =>'mnt/affadevice',</code><br>and skip the steps 5 to 8.
+
'AutomountDevice=>'/dev/sdc1',
 +
'AutomountPoint =>'mnt/affadevice',
 +
and skip the steps 5 to 8.
    
The mount point will be automatically created, if it does not exist. <br>
 
The mount point will be automatically created, if it does not exist. <br>
Line 358: Line 400:  
<b>Example 1:</b>  It's June, 12th 11:30, when user 'briedlin' asks you to restore the messages of his mailbox 'orders' he has inadvertently deleted today at 9:00 am.
 
<b>Example 1:</b>  It's June, 12th 11:30, when user 'briedlin' asks you to restore the messages of his mailbox 'orders' he has inadvertently deleted today at 9:00 am.
   −
1. You first must check what backup archives are available. The jobname of this server backup is 'prodserv'.<br><br><code># affa --list-archives prodserv</code><br>
+
<ol></li><li>You first must check what backup archives are available. The jobname of this server backup is 'prodserv'.
 +
affa --list-archives prodserv
 
<small><pre>
 
<small><pre>
 
Affa version 0.5.0 on affa1.mydomain.de (10.204.48.2)
 
Affa version 0.5.0 on affa1.mydomain.de (10.204.48.2)
Line 395: Line 438:  
</pre></small>
 
</pre></small>
   −
2. Choose the scheduled.1 archive, which was created less than two hours before the accident. Now restore the mailbox 'orders' using the rsync command.
+
</li><li>Choose the scheduled.1 archive, which was created less than two hours before the accident. Now restore the mailbox 'orders' using the rsync command.
 
+
</li><li>Now run the rsync command:
 
+
export RDIR=/home/e-smith/users/briedlin/Maildir/.orders/
3. Now run the rsync command:
+
Note the trailing slash!
 
+
rsync -av /var/affa/prodserv/scheduled.1/$RDIR 10.204.48.1:$RDIR
<code># export RDIR=/home/e-smith/users/briedlin/Maildir/.orders/</code><br>Note the trailing slash!
+
</li></ol>
 
  −
<code># rsync -av /var/affa/prodserv/scheduled.1/$RDIR 10.204.48.1:$RDIR</code>
  −
 
  −
 
  −
 
   
<b>Example 2:</b> A user has deleted the file orderform.pdf from ibay 'docs' and asks you to restore it.
 
<b>Example 2:</b> A user has deleted the file orderform.pdf from ibay 'docs' and asks you to restore it.
   −
1. You have searched and found the latest version of this file in archive weekly.1
+
<ol></li><li>You have searched and found the latest version of this file in archive weekly.
 
+
</li><li>Copy it back to the server:
2. Copy it back to the server:
+
export RFILE=/home/e-smith/files/ibays/docs/files/orderform.pdf
 
+
rsync -av /var/affa/prodserv/weekly.1/$RFILE 10.204.48.1:$RFILE
<code># export RFILE=/home/e-smith/files/ibays/docs/files/orderform.pdf</code>
+
</li></ol>
 
  −
<code># rsync -av /var/affa/prodserv/weekly.1/$RFILE 10.204.48.1:$RFILE</code>
  −
 
   
==== Full restore ====
 
==== Full restore ====
To run a full restore of user and configuration data run on the Affa server<br><code># affa --full-restore <JOB> [<ARCHIVE>]</code><br>This rsyncs the data from the backup ARCHIVE back to the 'remoteHostname' defined in the configuration of the job JOB.
+
To run a full restore of user and configuration data run on the Affa server
 +
affa --full-restore <JOB> [<ARCHIVE>]
 +
This rsyncs the data from the backup ARCHIVE back to the 'remoteHostname' defined in the configuration of the job JOB.
   −
Example:<br>
+
Example:
You have backuped your production server 'prodsrv' as job 'prodbox'. To restore from the latest backup run<br><code># affa --full-restore prodbox</code>
+
You have backuped your production server 'prodsrv' as job 'prodbox'. To restore from the latest backup run
 +
affa --full-restore prodbox
   −
To restore from the older archive daily.2 run<br><code># affa --full-restore prodbox daily.2</code><br>
+
To restore from the older archive daily. run  
 +
affa --full-restore prodbox daily.
    
'''Important note:''' A full restore reconstruct the server as it was at the time of the backup. That means, files created or server configuration changes after the backup run will be lost. After the restore is done, the restored server reboots automatically.
 
'''Important note:''' A full restore reconstruct the server as it was at the time of the backup. That means, files created or server configuration changes after the backup run will be lost. After the restore is done, the restored server reboots automatically.
  −
      
==== Moving a SME 7 server installation to new hardware using the Affa rise feature ====
 
==== Moving a SME 7 server installation to new hardware using the Affa rise feature ====
Line 442: Line 479:  
Alternatively you can smbmount the Windows disk to a directory on a SME server and setup a job to backup this directory.
 
Alternatively you can smbmount the Windows disk to a directory on a SME server and setup a job to backup this directory.
   −
<code>/bin/mount -t cifs //192.168.1.65/C$ /mnt/mywinpc/ -o username=Adminstrator,password=xxxxxx</code><br>
+
/bin/mount -t cifs //192.168.1.65/C$ /mnt/mywinpc/ -o username=Adminstrator,password=xxxxxx
 +
 
 +
If the Affa server is local to the Windows domain, you alternatively can use the Affa automount properties
   −
If the Affa server is local to the Windows domain, you alternatively can use the Affa automount properties<br>
+
AutomountDevice=>'//192.168.1.65/C$'
<code>AutomountDevice=>'//192.168.1.65/C$'<br>
+
AutomountPoint=>'/mnt/mywinpc/'
AutomountPoint=>'/mnt/mywinpc/'<br>
+
AutomountOptions=>'-t cifs -o username=Adminstrator,password=xxxxxx'
AutomountOptions=>'-t cifs -o username=Adminstrator,password=xxxxxx'</code><br>
      
Note: You may want to define a file that contains the username and password instead of having them in the AutomountOptions string. See 'man mount.cifs' for further information
 
Note: You may want to define a file that contains the username and password instead of having them in the AutomountOptions string. See 'man mount.cifs' for further information
Line 453: Line 491:  
Note: Affa cannot preserve the Windows ACLs. After a restore you must set owner and groups manually.
 
Note: Affa cannot preserve the Windows ACLs. After a restore you must set owner and groups manually.
   −
 
+
'''How can I move a backup archive from my production server in a remote branch office to the Affa server using an USB disk? I want to avoid to download the first full backup over the internet.'''
'''How can I move a backup archive from my production server in a remote branch office to the Affa server using an USB disk? I want to avoid to download the first full backup over the internet.'''<br>
   
Install Affa on your production server, connect and mount the USB disk. Setup a job to write the archive to the USB disk. After the job run, connect the USB disk to your Affa server and setup the job in the same way. Use the setup script from the archive directory. You only need to change the remoteHostName property. Now use the --move-archive option to move the archive to the local disk. If not already done, send the public key to your production server. You're done.
 
Install Affa on your production server, connect and mount the USB disk. Setup a job to write the archive to the USB disk. After the job run, connect the USB disk to your Affa server and setup the job in the same way. Use the setup script from the archive directory. You only need to change the remoteHostName property. Now use the --move-archive option to move the archive to the local disk. If not already done, send the public key to your production server. You're done.
      −
'''How do I backup two SME servers behind a firewall?'''<br>
+
'''How do I backup two SME servers behind a firewall?'''
 
First you need to configure port forwardings for the ssh service on your firewall. Use a non-standard port ,e.g 2200->22, for your second server. Setup a job on your Affa server for each of your production servers. Set up the job property sshPort=2200 for second server.
 
First you need to configure port forwardings for the ssh service on your firewall. Use a non-standard port ,e.g 2200->22, for your second server. Setup a job on your Affa server for each of your production servers. Set up the job property sshPort=2200 for second server.
  

Navigation menu