Remote Backup

After getting the 100 GB Backup space, i tried to mount it with NFS, but it seems timed out.

The backup space provider is also recommending rsync over NFS backup as its more efficient, can take daily backup as only changed file get backuped.

So i decided to take backup with rsync.

I started with server2.hosthat.com.

Step 1

Login to server2.hosthat.com on SSH as root.

Step 2

Check if RSA encryption key is present

# cat /root/.ssh/id_rsa.pub

If it is not present, create a key with the ssh-keygen utility

# ssh-keygen -t rsa -N ”

(note: these are two single quotes)

root@server2 [~]# ssh-keygen -t rsa -N ”
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
78:33:05:b4:9d:cf:f6:41:b7:11:4e:b1:bc:d7:58:04 root@server2.hosthat.com
root@server2 [~]#

Step 3

Copy your RSA encryption key to the remote backup system.

You may do this through the shell as well.

# scp ~/.ssh/id_rsa.pub flashwebhost@remove-backup-server.com:keys/server2
# ssh flashwebhost@remove-backup-server.com mergekeys

Step 4

You may now test rsync by copying a small directory, such as /etc:

# rsync -avz -e ssh /etc flashwebhost@remove-backup-server.com:server2

You may now add rsync as a daily cron job, as outlined in step 5.

Step 5

Backup /home folder

/usr/local/bin/rsync -avz -e ssh /home flashwebhost@remove-backup-server.com:server2


The Problem

Upto step 4 went with out problem, that is i can backup /etc folder to remote folder with out error.

But when i start backing up the /home folder, got the error

root@server2 [~]# rsync -avz -e ssh /home flashwebhost@remote-backup-server.com:server2 building file list … rsync: writefd_unbuffered failed to write 4092 bytes: phase “send_file_entry”: Broken pipe
rsync error: error in rsync protocol data stream (code 12) at io.c(515)
root@server2 [~]#

Solved this by installing latest version of rsync on the server.

It seems everything working fine. I am now running first rsync backup of /home directory by connecting to putty from a windows 2003 server, do i can check it later to see the status of the backup. I think next backups won’t take this much time as it only need to update files changed after last backup.

If everything went well, have to make a shell script to backup the files to remote server daily…. Not daily… May be every 4 days, else if a hacker compromised a clients web site, we will be making backup of that compromised code.


Posted in Uncategorized. Bookmark the permalink.