Rsync Backup and Restore Instructions

Rsync Backup and Restore Instructions

Rsync Backup/Restore Instructions

Category: Miscellaneous &nbsp

Detailed Rsync backup instructions are available

To begin, simply log in as root to your server using: shell access method (VPS Console, SSH, telnet, etc.) or control panel (Cpanel, Plesk, etc.)

If you do not have root access, log in to the account you will be using to perform backups.

Note: rsync requires read access to the files it is to back up. So, it is often executed as a root user. However, it may also work when executed from individual user accounts.

To log in to your VPS via Console.

Log in through SSH client tool on Linux Terminal.

Next, create an RSA encryption key

Create an RSA encryption key for use with the SSH transport. To check if a key already exists, run:

 

 cat ~/.ssh/id_rsa.pub

 

If the file already exists, you may skip it. Otherwise, create a key with the ssh-keygen utility:

 

 ssh-keygen -t rsa -N ''

 

 (Note: these are two single quotes)

Then, copy your RSA encryption key to the VPS.NET backup system

 It is possible to copy the key through the shell.

 

 scp ~/.ssh/id_rsa.pub user@rsync1.cloudkeeper.net:keys/DOMAIN_NAME

 

 

 ssh user@rsync1.cloudkeeper.net mergekeys

 

To make sure rsync is installed:

♦ For CentOS run:

 

  yum install rsync

 

 For Debian or Ubuntu:

 

 apt-get install rsync

 

Test rsync by copying a small directory, such as /etc:

 

 rsync -avz -e ssh /etc user@rsync1.cloudkeeper.net:DOMAIN_NAME/

 

Add rsync as a daily cronjob

 For Plesk Server Administrator:

 ◊ Go to Services choose System menu

 ◊ Add a new task as root

 ◊ Specify a Minute (0-59) and Hour (0-23) for the script to run each day.

 ◊ For Day of the Month, Month, and Day of the Week, just type a wildcard (*).

 The command will be in the format listed below.

 For Cpanel/WHM, it will be needed to add a crontab entry manually through the shell:

 ◊ Log in as root.

 ◊ To edit your crontab file, type the following command at the Linux shell prompt:

 

 crontab -e

 

Append the following entry:

 

 15 20 * * * rsync -avz --exclude=/proc --exclude=/sys --exclude=/dev -e ssh / 
user@rsync1.cloudkeeper.net:DOMAIN_NAME

 

Ctrl + X to Save and close the file (it depends on Editor that is used by default for CRONTAB).

Various rsync configurations:

Backup entire server:

 

 rsync -avz --exclude=/proc --exclude=/sys --exclude=/dev -e ssh / 
user@rsync1.cloudkeeper.net:DOMAIN_NAME

 

Bak up home directories:

 

 rsync -avz -e ssh /home user@rsync1.cloudkeeper.net:DOMAIN_NAME

 

Back up specific users:

 

rsync -avz -e ssh ~bob ~bill ~sarah user@rsync1.cloudkeeper.net:DOMAIN_NAME

 

View backup files/folders on Rsync backup server

SSH access has been permitted only from your vps.

Log in as root to your server

- shell access method (SSH)

Log in to your Rsync backup server via SSH.

User name for rsync backup is given on the top of the rsync backup instruction set.

 

  ssh user@rsync1.cloudkeeper.net

 

Type bash for getting “bash” shell

 

$ bash
[user@rsync1 /usr/home/user]$

 

View/List your files and directories.

Use “ls” command for listing your folders and files.

Also use -ltr option for listing long listing format, sort by modification time and reverse order while sorting.

 

[user@rsync1 /usr/home/user]$ ls -ltr

 

 

drwx------ 2 11166 11166 512 Jul 22 15:16 keys
drwxr-xr-x 3 11166 11166 512 Jul 22 15:17 DOMAIN_NAME

 

Then you can see your backup files and folders.

 

[user@rsync1 /usr/home/user]$ cd DOMAIN_NAME/
 
[user@rsync1 /usr/home/user/DOMAIN_NAME]$ ls -ltr

 

total 8

 

drwxr-xr-x 86 11166 11166 6656 Jul 22 14:50 etc

 

Type ‘exit’ or Ctrl + D two times for exiting from rsync server.

Restore a folder from Rsync backup

Log in as root to your server

To recover a file/folder from Rsync backup server. Use RSYNC or SCP commands.

 

 scp -r user@rsync1.cloudkeeper.net:source_file_or_folder destination_folder

 

Or

 

 rsync --progress -avz user@rsync1.cloudkeeper.net:source_file_or_folder 
destination_folder

 

 For example, If you want to recover a file called hosts from /etc folder to destination /tmp from your Rsync backup.

 

 scp -r user@rsync1.cloudkeeper.net:/usr/home/user/DOMAIN_NAME/etc/hosts /tmp/

 

 

 rsync --progress -avz user@rsync1.cloudkeeper.net:/usr/home/user/DOMAIN_NAME/etc/hosts /tmp/
    • Related Articles

    • FTP Instructions

      FTP Instructions Category: Hosted Apps &nbsp File Transfer Protocol (FTP) is a standard network protocol used to copy a file from one computer to another. FTP users may authenticate themselves using a clear-text sign-in protocol. To begin, you will ...
    • How to increase tmp partition size

      How to increase /tmp partition size Category: Cloud Servers, Firewall, OS related issues, Other services, VPS.net features &nbsp Most linux servers have a separate /tmp partition to prevent from filling up the root directory with temporary files. ...
    • Galera MySQL Recommended Cluster Configuration

      Galera/MySQL recommended cluster configuration Category: Template Information &nbsp For practical purposes Galera/MySQL vendor recommend to reserve a “Reference Node” in the cluster. We propose the cluster looks like: Reference Node cluster A ...
    • How to enable Backups for a Linux server

      How to enable Backups for a Linux server Category: Getting Started &nbsp Give your server a new lease of life with a quick and easy update… There comes a time in every server’s life when it needs a slightly newer version of its software. Thankfully, ...
    • Clone Server Feature in VPS.net Control Panel

      Clone and deploy feature allows to create an entirely new server from an existing one, moreover, using it you can create a completely customized image based on different options, and rapidly deploy the image to a new server. This feature is only ...