ID #1397

How can I save my files to my BackupHD with rsync ?

Rsync provides a vast number of options. This how-to  confines to the most simple and common functions. More detailed information can be found in the rsync manual (under Linux: man rsync).

In order to use BackupHD you need to enable the function in the customer center. To this click the menu point "Verwaltung" after selecting your contract and enable the tick under "Rsync aktiv". After that click the "Ändern" button. Your BackUP will be enabled for rsync within 24 hours.

The general command reads:

# rsync [user]@[server]::[module]

[user] - Your FTP account
[server] - In case of the BackupHD for example rsync1.euserv.de
[modulel] - Your FTP account

Hint: The FTP Account has to be stated twice, to ensure only the FTP account is allowed to access the respective rsync module.

Encryption via SSH

To encrypt the file transfer via an SSH connection enter the parameter "-e ssh".

# rsync -e ssh  [user]@[server]::[module]

[user] - Your FTP account
[server] - In case of the BackupHD for example rsync1.euserv.de
[module] - Your FTP account
-e ssh   - Using an SSH connection

If you are using the connection via SSH you have to enter your password twice. The first time for the SSH connection and the second time for the rsync connection.

 

rsync via stunnel

Examples:

1. Simple command for backing up the EUserv BackupHD:

The file /etc/resolv.conf is supposed to be saved in the folder  /backup/ on the server.

# rsync /etc/resolv.conf -e ssh --progress ftpbackup-1234@rsync1.euserv.de::ftpbackup-1234/backup/


--progress - This parameter displays a progress bar during the transfer.

 

2. Incremental backup

The folder /var/www/ is supposed to be saved completely on the BackupHD.

# rsync -avuzR -e ssh /var/www/ --progress ftpbackup-1234@rsync1.euserv.de::ftpbackup-1234

-a Archive Mode - Keeps the file attributes
-u update - Only overwrites files if they are more up-to-date.
-v verbose - Extended output

-z compress - Compressing in order to save bandwidth.
-R relative - Uses the complete path statement on the server, i.e. the backup will be stored in the /var/www/ folder on the server (without -R this will take place in the folder /www/)

 

3. Backup without password prompt

 

With  "--password-file" you can use rsync without a password prompt

If you use ssh encryption, the tool sshpass is required.

On Debian based distributions you can install sshpass with apt-get/aptitude: sudo apt-get install sshpass. Alternatively you can compile sshpass from source. http://sourceforge.net/projects/sshpass/

Create a textfile that includes your rsync password, e.g. /root/rsync_pass. This file should belong to the user, that is executing the rsync command. it should have the rights 700.

 

The backup can be executed with the following command:

# sshpass -f /root/rsync_pass  /usr/bin/rsync -e ssh --password-file /root/rsync_pass   [Verzeichnis] [Nutzer]@[Server]::[Modul]

 

For further information:

# man rsync

Tags: BackupHD, ftp, online disk, rsync

Verwandte Artikel:

Kommentieren nicht möglich