Wednesday 19 October 2011

Backup Server to Server Linux

1: ssh user@server1.com
2: enter passwrod:
3: Checkout your server available space
4: Command is # df -h
5: If you have enough space on the server to compress your data then compress first
6: tar -cvzf yourfilename.tar.gz yourfilename
7: or you can take the whole directory to compress
8: tar -cvzf yourdirectory.tar.gz yourdirectory/.*
9: You have take the backup of important files and folders.
10: Take backup of
-->Configuration files
-/etc/httpd/conf/httpd.conf
-/etc/php.ini
-All the configuration files of application you are running on the server.
11: Take backup of /var/www/html/.* in CentOs and /var/www/html/sites-availble in ubuntu.
12: When the tar.gz is completed then transfer the compressed data to another server for backup.
13: If you do not have much more space on the server then you can transfer the open data from one server to another one.
13: Login to your second server through ssh
14: Create a folder there with the name of backup-server1 if you have enough space.
15: Now come back to terminal 1st user@yourserver1.com ( server 1)
16: Copy all the tar files to server2 user@yourserver2.com by the following commands
17: scp -drp folder1.tar.gz user@server2.com:~/backup-server1/
18: scp -drp folder2.tar.gz user@server2.com:~/backup-server1/
19: scp -drp folder3.tar.gz user@server2.com:~/backup-server1/
20: scp -drp folder4.tar.gz user@server2.com:~/backup-server1/

all Your data will be backup to server2.
21: To Transfer the open file run the following commands
scp -drp /var/www/html/site1.com/.* user@server2.com:~/backup-server1/var/www/html/site1.com
but first you have to create a folder on the server server2 in /var/www/html/site1.com then run the command above.
22: Check your data size on both the servers.

23: Backup /var/log/.* Directory as well and delete all the log files to create space on your server.

This is an overview of how to take backup of server and make it possible to transfer to another server. if you are facing any issue on taking backup. i will be happy to assist you from here. so feel free to post the issue you are facing.

Regards:
Imran shahmeer

No comments:

Post a Comment