Difference between revisions of "Backup server config"

From SME Server
Jump to navigationJump to search
m (Minor text and layout changes)
m (Added ordered list)
Line 43: Line 43:
 
You can delete any users, ibays, groups and other settings not required on the restored server via server manager.
 
You can delete any users, ibays, groups and other settings not required on the restored server via server manager.
  
It is preferable to tar/untar data so you don't loose ownership and permissions during the copy from server1 to server2. If copying user data & email using normal copy commands, then ensure that ownership is correct on the new server.
+
It is preferable to tar/untar data so you don't loose ownership and permissions during the copy from server1 to server2. If copying user data and email using normal copy commands, then ensure that ownership is correct on the new server.
  
 
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
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
  
 
+
</li><li>Use scp to copy the tarred files between machines by doing (on server1)
Use scp to copy the tarred files between machines by doing (on server1)
 
 
{{Note box|You will have to have remote access between the servers setup to be able to ssh, either using passwords or ssh keys.}}
 
{{Note box|You will have to have remote access between the servers setup to be able to ssh, either using passwords or ssh keys.}}
 
  scp /temp/users.tar.gz server2IP:/home/e-smith/files/
 
  scp /temp/users.tar.gz server2IP:/home/e-smith/files/
Line 65: Line 63:
 
where xxxx = port number
 
where xxxx = port number
  
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
Line 76: Line 74:
 
  cd /home/e-smith/files/users
 
  cd /home/e-smith/files/users
 
  chown -R username:username username
 
  chown -R username:username username
 
+
</li></ol>
 
----
 
----
 
[[Category:Howto]]
 
[[Category:Howto]]

Revision as of 11:49, 1 September 2007

Backup server configuration

Overview

This method utilizes the standard backup to desktop function. Data in ibays and user folders is temporarily moved to a temp folder, which will not be included in the backup. If required, user, ibay and other data can be manually copied from the backup server to the restored server either partially or in total after the restore.

If you have large amounts of data in other locations, then that should also be moved to the /tmp/temp folder.

This method is a good way to create a server clone that has identical configuration but no data, without going through all the setup again.

Procedure

It is preferable to make a /temp folder as files in /tmp are routinely automatically deleted by the server, and using /temp will avoid unwanted inadvertent deletion.

If you don't have much data or email in /home/e-smith/files/users then don't bother to move that.

On the server to be backed up (server1) do

mkdir -p /temp
mv /home/e-smith/files/users /temp
mv /home/e-smith/files/ibays /temp

Perform backup to desktop on server1 using the standard server manager panel

Then on server1 do

mv /temp/users /home/e-smith/files/
mv /temp/ibays /home/e-smith/files/

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.

Perform Restore from desktop on server2 using the standard server manager panel.

On the restored server (server2), login as admin and select Configure this server. Change the local IP and other settings as required, detect different NIC's, and also change to server only mode if it's going to be a second server on your network (where the backed up server was a server/gateway) and disable the DHCP server. As a minimum, make sure you change the local IP on the restored server as it will be identically configured after the restore. Then log in to server manager on the restored server and change workgroup name and domain controller settings and any other settings required etc.

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

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 delete any users, ibays, groups and other settings not required on the restored server via server manager.

It is preferable to tar/untar data so you don't loose ownership and permissions during the copy from server1 to server2. If copying user data and email using normal copy commands, then ensure that ownership is correct on the new server.

Modify the following commands appropriately to only move the data you require.

  1. Use tar to compress all the user and ibays folders (on server1) by doing cd /home/e-smith/files tar -czvf /temp/users.tar.gz users tar -czvf /temp/ibays.tar.gz ibays
  2. Use scp to copy the tarred files between machines by doing (on server1)
    Important.png Note:
    You will have to have remote access between the servers setup to be able to ssh, either using passwords or ssh keys.

    scp /temp/users.tar.gz server2IP:/home/e-smith/files/
    scp /temp/ibays.tar.gz server2IP:/home/e-smith/files/ 
    

    If ssh is configured for a different port (than 22) use

    scp -P xxxx /temp/users.tar.gz server2IP:/home/e-smith/files/
    scp -P xxxx /temp/ibays.tar.gz server2IP:/home/e-smith/files/
    

    where xxxx = port number

  3. Use tar to uncompress all the user and ibay folders by doing (on server2) cd /home/e-smith/files/ tar -xvzf users.tar.gz tar -xvzf ibays.tar.gz rm /home/e-smith/files/users.tar.gz rm /home/e-smith/files/ibays.tar.gz If required, to correct ownership for each user on server2 do cd /home/e-smith/files/users chown -R username:username username