Changes

Jump to navigation Jump to search
4,841 bytes added ,  11:59, 21 April 2021
m
Line 1: Line 1: −
== Backup server configuration ==
+
{{usefulnote}}
 +
==Backup the server configuration==
    
===Overview===
 
===Overview===
   −
{{Warning box|This is a non standard method of transferring data between servers and should be carefully used to ensure that no data is lost or altered during the process. If wrong or inappropriate copying procedures are used, your data may have incorrect permissions applied. Using tar and scp is the "best" way to transfer files directly between servers while retaining correct permissions/ownership in the process.}}
+
{{Warning box|This is a non-standard method of transferring data between servers and should be used carefully to ensure that no data is lost or altered during the process. If wrong or inappropriate copying procedures are used, your data may have incorrect permissions applied. Using tar and scp is the "best" way to transfer files directly between servers while retaining correct permissions/ownership in the process.}}
      Line 18: Line 19:  
If you have large amounts of data in other locations that will cause your backup file to exceed 2Gb, then that data should also be temporarily moved to the /temp folder, and manually copied to the new server after the restore.
 
If you have large amounts of data in other locations that will cause your backup file to exceed 2Gb, then that data should also be temporarily moved to the /temp folder, and manually copied to the new server after the restore.
   −
{{Note box|With sme 7.2 or newer, it is possible to create a backup to desktop smeserver.tgz file of the order of 52Gb, when saved to a share or a connected drive formatted with a NTFS or ext3 file system and when using Firefox as the browser. See bug 81.}}
+
{{Note box|msg=With sme 7.2 or newer, it is possible to create a backup to desktop smeserver.tgz file of the order of 52Gb, when saved to a share or a connected drive formatted with a NTFS or ext3 file system and when using Firefox as the browser. [[bugzilla:81]].}}
      −
===Procedure===
+
====Procedure====
    
{{Note box|This method does transfer mysql database information.}}
 
{{Note box|This method does transfer mysql database information.}}
Line 31: Line 32:       −
<ol></li><li>On the server to be backed up (server1) do
+
<ol><li>On the server to be backed up (server1) do
 
  mkdir -p /temp
 
  mkdir -p /temp
mv /home/e-smith/files/users /temp
+
mv /home/e-smith/files/users /temp
mv /home/e-smith/files/ibays /temp
+
mv /home/e-smith/files/ibays /temp
mv /home/e-smith/files/xxxx /temp
+
mv /home/e-smith/files/xxxx /temp
    
</li><li>Perform backup to desktop on server1 using the standard server manager panel
 
</li><li>Perform backup to desktop on server1 using the standard server manager panel
Line 41: Line 42:  
</li><li>Then on server1 do
 
</li><li>Then on server1 do
 
  mv /temp/users /home/e-smith/files/
 
  mv /temp/users /home/e-smith/files/
mv /temp/ibays /home/e-smith/files/
+
mv /temp/ibays /home/e-smith/files/
mv /temp/xxxx /home/e-smith/files/
+
mv /temp/xxxx /home/e-smith/files/
    
</li><li>Build another server to restore to (server2), and perform a fresh install of sme server on it. Note that any preferred hardware can be used, it does not need to be physically identical to the original server the backup was performed on.
 
</li><li>Build another server to restore to (server2), and perform a fresh install of sme server on it. Note that any preferred hardware can be used, it does not need to be physically identical to the original server the backup was performed on.
Line 54: Line 55:  
You should now have a second server (server2) which is identically configured to server1 (except for changes that were made) but without user and ibay data. Note that the user and ibays will exist in server manager and in the file structure, but they will be empty.
 
You should now have a second server (server2) which is identically configured to server1 (except for changes that were made) but without user and ibay data. Note that the user and ibays will exist in server manager and in the file structure, but they will be empty.
   −
===Copying data to the restored server===
+
====Copying data to the restored server====
    
You can then optionally transfer the data across the network from server to server either totally or in limited form as required using command line, tar and scp.  
 
You can then optionally transfer the data across the network from server to server either totally or in limited form as required using command line, tar and scp.  
Line 63: Line 64:  
Modify the following commands appropriately to only move the data you require.
 
Modify the following commands appropriately to only move the data you require.
   −
<ol></li><li>Use tar to compress all the user and ibays folders (on server1) by doing
+
<ol><li>Use tar to compress all the user and ibays folders (on server1) by doing
 
  cd /home/e-smith/files
 
  cd /home/e-smith/files
tar -czvf /temp/users.tar.gz users
+
tar -czvf /temp/users.tar.gz users
tar -czvf /temp/ibays.tar.gz ibays
+
tar -czvf /temp/ibays.tar.gz ibays
tar -czvf /temp/xxxx.tar.gz xxxx
+
tar -czvf /temp/xxxx.tar.gz xxxx
    
</li><li>Use scp to copy the tarred files between machines by doing (on server1)
 
</li><li>Use scp to copy the tarred files between machines by doing (on server1)
Line 76: Line 77:     
If ssh is configured for a different port (than 22) use
 
If ssh is configured for a different port (than 22) use
  scp -P zzzz /temp/users.tar.gz server2IP:/home/e-smith/files/
+
   
 +
scp -P zzzz /temp/users.tar.gz server2IP:/home/e-smith/files/
 
  scp -P zzzz /temp/ibays.tar.gz server2IP:/home/e-smith/files/
 
  scp -P zzzz /temp/ibays.tar.gz server2IP:/home/e-smith/files/
 
  scp -P zzzz /temp/xxxx.tar.gz server2IP:/home/e-smith/files/
 
  scp -P zzzz /temp/xxxx.tar.gz server2IP:/home/e-smith/files/
Line 84: Line 86:  
</li><li>Use tar to uncompress all the user and ibay folders by doing (on server2)
 
</li><li>Use tar to uncompress all the user and ibay folders by doing (on server2)
 
  cd /home/e-smith/files/
 
  cd /home/e-smith/files/
tar -xvzf users.tar.gz
+
tar -xvzf users.tar.gz
tar -xvzf ibays.tar.gz
+
tar -xvzf ibays.tar.gz
tar -xvzf xxxx.tar.gz
+
tar -xvzf xxxx.tar.gz
rm /home/e-smith/files/users.tar.gz
+
rm /home/e-smith/files/users.tar.gz
rm /home/e-smith/files/ibays.tar.gz
+
rm /home/e-smith/files/ibays.tar.gz
rm /home/e-smith/files/xxxx.tar.gz
+
rm /home/e-smith/files/xxxx.tar.gz
 
   
If required, to correct ownership for each user on server2 do
 
If required, to correct ownership for each user on server2 do
   
  cd /home/e-smith/files/users
 
  cd /home/e-smith/files/users
chown -R username:username username
+
chown -R username:username username
 
</li></ol>
 
</li></ol>
   −
===Manually transferring configuration information===
+
====Manually transferring configuration information====
    
If you wish to manually transfer configuration information from an old server to a new server you can use the following steps. All the files listed below are required as user information & passwords is contained in many different locations.
 
If you wish to manually transfer configuration information from an old server to a new server you can use the following steps. All the files listed below are required as user information & passwords is contained in many different locations.
Line 140: Line 140:  
  reboot
 
  reboot
   −
===Standard backup & restore inclusions===
+
 
 +
====Cloning a server for Test purposes, using inclusion & exclusion files====
 +
 
 +
This alternative method can be used to clone a server for test purposes, and utilises inclusion & exclusion text files to specify what the backup tgz file will contain. Refer forum post http://forums.contribs.org/index.php/topic,46546.msg228428.html#msg228428
 +
 
 +
Warning: This procedure is meant to be used for testing purposes ONLY, where you wish to trial changes etc before implementing them on a "near to identically configured" production server.
 +
 
 +
=====Procedure to create the backup on the server to be cloned=====
 +
 
 +
Create a file named include.txt in /root/ with this content:
 +
touch /root/include.txt
 +
pico -w /root/include.txt
 +
Edit the file to contain the following (which is a deviation from the standard backup inclusion set of files & folders)
 +
home/e-smith/
 +
etc/e-smith/templates-custom
 +
etc/e-smith/templates-user-custom
 +
etc/group
 +
etc/gshadow
 +
etc/passwd
 +
etc/samba/secrets.tdb
 +
etc/samba/smbpasswd
 +
etc/shadow
 +
etc/smbpasswd
 +
etc/ssh
 +
etc/sudoers
 +
root
 +
Save & exit
 +
Ctrl o
 +
Ctrl x
 +
 
 +
Create a file named /root/exclude.txt with this content:
 +
touch /root/exclude.txt
 +
pico -w /root/exclude.txt
 +
Edit the file to contain the following (which is the list of files & folders you wish to exclude from the backup)
 +
home/e-smith/files/ibays/*/files/*
 +
home/e-smith/files/users/*/home/*
 +
Save & exit
 +
Ctrl o
 +
Ctrl x
 +
 
 +
Run the pre-backup event (to dump the mysql tables to a file in /home/e-smith/db/mysql/)
 +
signal-event pre-backup
 +
 
 +
Run the tar command to create the smeserver.tgz backup file (the --totals directive is not strictly necessary, it is to provide information only)
 +
tar -cz --totals -vvp  --directory / --exclude-from=./exclude.txt --files-from=./include.txt  -f /tmp/smeserver.tgz
 +
 
 +
=====Procedure to restore the backup on the cloned server=====
 +
 
 +
Copy the smeserver.tgz file to the cloned server via ssh or via usb disk and follow the steps in this section of the Backup server config wiki article http://wiki.contribs.org/Backup_server_config#Command_line_manual_Restore_from_USB_drive_or_memory_stick
 +
 
 +
Ensure you prepare the new server for the restore, by issuing the following command
 +
signal-event pre-restore
 +
and then follow the steps referred to above.
 +
 
 +
 
 +
Performing the Procedures indicated above, will create a "near to identical" clone of the original server without user data and files in ibays. It will still contain user mail messages.
 +
 
 +
==Standard backup & restore inclusions==
    
This command will give a listing of the files & folders included in a standard backup & restore, as per a default install of sme server.
 
This command will give a listing of the files & folders included in a standard backup & restore, as per a default install of sme server.
Line 146: Line 203:  
  perl -e 'use esmith::Backup; $b = new esmith::Backup;print join("\n",$b->restore_list)'
 
  perl -e 'use esmith::Backup; $b = new esmith::Backup;print join("\n",$b->restore_list)'
   −
Which on a sme7.3 server shows:
+
Here is the output on three versions of SME. The difference between SME 7.5 and the others is important.  
    +
{| class="wikitable"
 +
|-
 +
!SME 9!!SME 8.2!!SME 7.5.1
 +
|-
 +
|
 +
home/e-smith
 +
etc/e-smith/templates-custom
 +
etc/e-smith/templates-user-custom
 +
etc/ssh
 +
root
 +
etc/sudoers
 +
etc/passwd
 +
etc/shadow
 +
etc/group
 +
etc/gshadow
 +
etc/samba/secrets.tdb
 +
etc/samba/smbpasswd
 +
||
 +
home/e-smith
 +
etc/e-smith/templates-custom
 +
etc/e-smith/templates-user-custom
 +
etc/ssh
 +
root
 +
etc/sudoers
 +
etc/passwd
 +
etc/shadow
 +
etc/group
 +
etc/gshadow
 +
etc/samba/secrets.tdb
 +
etc/samba/smbpasswd
 +
||
 
  home/e-smith
 
  home/e-smith
 
  etc/e-smith/templates-custom
 
  etc/e-smith/templates-custom
Line 160: Line 248:  
  etc/samba/secrets.tdb
 
  etc/samba/secrets.tdb
 
  etc/samba/smbpasswd
 
  etc/samba/smbpasswd
  etc/smbpasswd
+
  etc/smbpasswd  
 
+
|}
    
All files/scripts associated with the standard backup and restore processes can be found with this command.
 
All files/scripts associated with the standard backup and restore processes can be found with this command.
Line 169: Line 257:  
The inclusion list can be found in
 
The inclusion list can be found in
   −
/usr/lib/perl5/site_perl/esmith/Backup.pm
+
/usr/lib/perl5/site_perl/esmith/Backup.pm
 +
 
 +
In SME 9.2 it is at:
 +
/usr/share/perl5/vendor_perl/esmith/Backup.pm
 +
 
 +
{{Note box|Please note that the path to emsith perl libraries as of SME Server 9.x has changed to '''/usr/share/perl5/vendor_perl/esmith'''.}}
    
Changes to this file will be overwriten during upgrades.
 
Changes to this file will be overwriten during upgrades.
    +
===Modifying the standard backup inclusions & exclusions===
 +
 +
To modify the included & excluded folders & files, refer to http://wiki.contribs.org/Backup_with_dar#Adding.2FExcluding_Directories_and_Files_from_the_backup_list
   −
===Data size calculation for backups===
+
==Data size calculation for backups==
    
Depending on where data is stored on your server, the backup size reported by the server-manager may be less accurate eg if a lot of data is stored in /opt  
 
Depending on where data is stored on your server, the backup size reported by the server-manager may be less accurate eg if a lot of data is stored in /opt  
Line 220: Line 316:  
  151G    total
 
  151G    total
   −
===Command line manual Restore from USB drive or memory stick===
+
==Command line manual Restore from USB drive or memory stick==
    
This is not the usual recommended way to do Restores, but if required it can be achieved.
 
This is not the usual recommended way to do Restores, but if required it can be achieved.
Line 260: Line 356:  
Different USB-Disks/Sticks and have been tested and it was observed that external USB-Drives with external Power run error free, but some USB-Sticks and USB-Disks powered by the USB port bus, can have issues (possibly low voltage/Hal-Daemon problems).
 
Different USB-Disks/Sticks and have been tested and it was observed that external USB-Drives with external Power run error free, but some USB-Sticks and USB-Disks powered by the USB port bus, can have issues (possibly low voltage/Hal-Daemon problems).
   −
for restore to a new other Server (newserver.home.net)make..
+
----
after reboot delete old DNS Data inside SME
+
 
# db host show oldserver.home.net.. to list old entrys!!
+
'''For Restore to a new other SME-Server with new Domain-FQDN (newserver.home.net)'''.
 +
<br>delete old DNS entrys inside SME Database after a reconfigure+reboot!
 +
<pre>
 +
#db host show   (to list old entries!! like oldserver.home.net..) or #db host show > domainlist.txt (to export high count of entries
    
and remove old with
 
and remove old with
   −
db hosts delete oldserver.XXXX.XXX        XXX= domains.net  mit prename oldserver!!
+
#db hosts delete oldserver.XXXX.XXX        (XXX= domains.net  mit prename oldserver!!)
signal-event post-upgrade
+
#signal-event post-upgrade
signal-event reboot
+
#signal-event reboot
 +
</pre>
 +
Check at Admin-Console(SSH-Login) -> Server Configuration -> IP  if you have to change NEWSERVER-IP & FQDN!! Cause Restore set the IP & FQDN of OLDSERVER!!
 +
login again into https://yourserver/server-manager/ to check Domain settings
    
ready..
 
ready..
   −
===Restore on initial reboot after fresh OS install - How to Reset option===
+
----
 +
 
 +
==Restore on initial reboot after fresh OS install - How to Reset option==
    
A full Restore from a backup file (eg located on a USB drive) is only recommended to be done immediately after installing a fresh sme server operating system. If this option is not selected on the first reboot, then the option is no longer available on subsequent reboots.
 
A full Restore from a backup file (eg located on a USB drive) is only recommended to be done immediately after installing a fresh sme server operating system. If this option is not selected on the first reboot, then the option is no longer available on subsequent reboots.
Line 288: Line 392:  
For example, if ibays were previously configured, then these will still be in the file system but they will not be displayed in server manager.
 
For example, if ibays were previously configured, then these will still be in the file system but they will not be displayed in server manager.
   −
===Backup and Restore concepts, issues and other information===
+
==Backup and Restore concepts, issues and other information==
    
The sme backup & restore concept is that only data (users & ibays) and configuration (including all mysql dbs and custom templates) is backed up & restored.
 
The sme backup & restore concept is that only data (users & ibays) and configuration (including all mysql dbs and custom templates) is backed up & restored.
Line 324: Line 428:  
The DAR2 contrib has a web interface that is configurable and allows you to create the disaster recovery backup (ie all data and configuration) required to rebuild a server, but you still need to reinstall add on contribs (rpms). It also allows selective backup jobs to be done, eg of certain ibays only, depending on your particular needs.
 
The DAR2 contrib has a web interface that is configurable and allows you to create the disaster recovery backup (ie all data and configuration) required to rebuild a server, but you still need to reinstall add on contribs (rpms). It also allows selective backup jobs to be done, eg of certain ibays only, depending on your particular needs.
   −
===Reference links===
+
====Cifs Error====
 +
When using the included backup functionality, or the DAR2 contrib, backing up to a windows remote share generates the following cifs errors. see [[bugzilla:7341]]
 +
Feb 12 11:51:25 sme e-smith-bg: Connecting /mnt/dar2/backup to \\192.168.10.30\bkp
 +
Feb 12 11:51:25 sme kernel:  CIFS VFS: Send error in SessSetup = -12
 +
Feb 12 11:51:25 sme kernel:  CIFS VFS: cifs_mount failed w/return code = -12
 +
Feb 12 11:51:25 sme e-smith-bg: mount error(12): Cannot allocate memory
 +
Feb 12 11:51:25 sme e-smith-bg: Refer to the mount.cifs
 +
 
 +
The solution could be to modify the windows registry by the file below
 +
 
 +
Windows Registry Editor Version 5.00
 +
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
 +
"LargeSystemCache"=dword:00000001
 +
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters]
 +
"Size"=dword:00000003
 +
 
 +
Save the content above in a file with the name W7-backup.reg and import it in the windows registry, restart the service or the Windows computer
 +
 
 +
==Reference links==
    
http://wiki.contribs.org/UpgradeDisk
 
http://wiki.contribs.org/UpgradeDisk

Navigation menu