Hetzner - DokuWiki

Backup/en

Inhaltsverzeichnis

Backup Space

All dedicated/virtual server clients can order backup space with their server. Backup space can only be accessed from within the Hetzner network. Any server located at Hetzner can connect to the backup space.

The available backup space options, as well as their prices, can be found in the table below:

Backup Space Monthly Fee
100 GB* € 2.90*
500 GB € 4.90
1,000 GB € 7.90
2,000 GB € 9.90
5,000 GB € 21.90
10,000 GB € 39.90

*A dedicated server costing € 39.00 per month or more can get 100 GB backup space for free.

Prices plus VAT, if applicable.

Ordering Backup Space

Backup space can be ordered via the Robot. Under "Main Functions; Server" select the desired server and then open the tab "Backup". Here you can order different sizes of backup space, as well as up/downgrading your current backup space.

Functions in the Robot

Under the "Backup" tab of your server in the Robot you can complete the following tasks:

  • Order backup space
  • Up/downgrade backup space
  • Delete backup space
  • Generate a new password
  • Graphically display the current usage (updated every 10 minutes)

General Notes

The upload speed for backup space is dependent on how many other clients are simultaneously accessing the same backup server. Consider running your backups at another time if you experience performance problems.

It is important to use the DNS names assigned to your backup space (<username>.your-backup.de) instead of the underlying IP address, as the IP address can change.

Useful Software

Accessing Backup Space

Backup space can be accessed via various different protocols.

FTP/FTPS/SFTP/SCP

You can access your backup space by means of FTP, FTPS, SFTP and SCP. Please use the host names assigned to you (<username>.your-backup.de) as well as your username and password.

Public Key Authentication

For SFTP/SCP it is possible to authenticate yourself with a Public Key. More information, as well as an example, can be found on the following wiki page: Backup Space SSH Keys.

Restrictions

It is not possible to create the folders "/etc" or "/lib" on backup space.

Connection Error

11: Application Error

If you receive this error when trying to connect via SFTP or SCP, then this could be the result of SSH Key Forwarding being activated. Please deactivate this for the backup space, and try connecting again.

SAMBA/CIFS

You have the option of integrating your backup space with Samba/Cifs. To do so, you can use the following UNC path:

\\<username>.your-backup.de\backup
mount.cifs -o user=<username>,pass=<password> //<username>.your-backup.de/backup /PATH/FOLDER

Furthermore, with the following line of code in /etc/fstab the backup space will be mounted automatically during boot time:

//<username>.your-backup.de/backup /mnt/backup-server       cifs    iocharset=utf8,rw,credentials=/etc/backup-credentials.txt,uid=<System account>,gid=<System group>,file_mode=0660,dir_mode=0770 0       0

The file /etc/backup-credentials.txt (mode 0600) should contain the following two lines:

username=<username>
password=<password>

On Debian-based distributions, the command is provided via the package cifs-utils

apt-get install cifs-utils

On Windows systems if necessary, a Windows User needs to be created with the backup account name and password, so that the backup works with the built-in Windows tools. The user needs "Administrator" or "Backup Operator" rights.

WebDAV

You can access your backup account using WebDAV and use davfs to integrate your backup account.

To mount the WebDAV directory, the following command can be used:

mount -t davfs https://<username>.your-backup.de /MOUNTPOINT

You can also use the following line in /etc/fstab to automate the mounting procedure each time the system is started:

https://<username>.your-backup.de /MOUNTPOINT davfs
rw,uid=<System account>,gid=<System group>,file_mode=0660,dir_mode=0770,_netdev 0 0

So that the WebDAV directory can mount automatically, you need to add the following line in the /etc/davfs2/secrets file:

https://<username>.your-backup.de <username> <password>

On Debian based distributions, davfs2 is provided under the package of the same name.

apt-get install davfs2

On Windows, it may be necessary to install the feature "Desktop Experience".

Unfortunately, WebDAV does not support the determining of the available space and it will report false values. Please use sftp instead, as is described in the section Determining memory usage.

SSH / rsync / BorgBackup

You can access your backup space via an SSH connection to use rsync and BorgBackup there. Use port 23 to access your backup space for this purpose.

To create an SSH connection on your backup space, first activate the SSH support setting for your backup space via the Robot administration interface.

Important note: For the SSH key authentication, you must save a public SSH key in normal OpenSSH format on your backup space. Do not save the key in RFC4716 format. For a more detailed guide, please see our Wiki page Backup Space SSH Keys.

Please also note that only the directory /home/ is writable on the backup space. To address directories or files on the backup space, we therefore recommend that you use relative paths. For example, to download the file /server1/full_backup.tar.gz from the backup space, you can use the following file paths:

server1/full_backup.tar.gz
./server1/full_backup.tar.gz

Interactive SSH access is not allowed.

BorgBackup

With BorgBackup, you can save encrypted deduplicated backups to your backup space. You can find a guide for how to do this at BorgBackup.

rsync

You can use rsync to synchronize the state of your directories with your backup space. For example, to synchronize a local directory with the backup space, you can use rsync as follows:

rsync --progress -e 'ssh -p23' --recursive <local directory> <username>@<username>.your-backup.de:<target directory>

To re-download a directory from the backup space, you only need to swap the directories:

rsync --progress -e 'ssh -p23' --recursive <username>@<username>.your-backup.de:<directory> <local directory>

Please note that it is not possible to customize the user and group ID of the uploaded files.

SCP

You can also use port 23 to use SCP. To upload a file via SCP, you can execute the following command:

scp -P 23 <local file> <username>@<username>.your-backup.de:<remote file>

To download the file again, you only have to swap the target and source files:

scp -P 23 <username>@<username>.your-backup.de:<remote file> <local file>

SFTP

Accessing your backup space via SFTP is similar to accessing it with an FTP client. To start an SFTP session, please execute the following command:

sftp -P 23 <username>@<username>.your-backup.de

You can then upload files using put and download them using get. With ls you get a directory listing:

sftp> put 100MB.file
Uploading 100MB.file to /home/100MB.file
100MB.file                           100%  100MB  78.7MB/s   00:01
sftp> ls -ahl
drwxr-xr-x    0 12345      12345     16B  Mar 28 10:55 .
dr-x--x--x    0 0          0         10B  Mar 27 12:16 ..
-rw-r--r--    0 12345      12345     100M Mar 28 11:34 100MB.file
sftp> get 100MB.file
Fetching /home/100MB.file to 100MB.file
/home/100MB.file                     100%  100MB 110.6MB/s   00:00
sftp> quit

IPv6

You can access your backup space with the same hostname via IPv6.

BorgBackup

With BorgBackup you can save encrypted deduplicated backups to your backup space. For setup instructions, visit the BorgBackup wiki page.

Determining disk usage

To find out how much free space you have (be it via backup scripts or status emails) you can use the program "sftp":

apt-get install sftp
echo "df"     | sftp <username>@BACKUPSERVER
echo "df -h"  | sftp <username>@BACKUPSERVER
echo "df -hi" | sftp <username>@BACKUPSERVER

"lftp" can also be used. However, under certain circumstances lftp can give you incorrect values, which is why sftp is recommended. The following is the variant with lftp:

# apt-get install lftp
# echo du -hs .  \
| lftp -u <username>,<password> BACKUPSERVER

The following command allows you to use a hook to link with Tartarus by inserting the following lines in the Tartarus configuration:

TARTARUS_POST_PROCESS_HOOK() {
echo "du" | /usr/bin/lftp -u "$STORAGE_FTP_USER,$STORAGE_FTP_PASSWORD" "$STORAGE_FTP_SERVER" | awk -v LIMIT=100 '$2=="." {print ((LIMIT*1024*1024)-$1)/1024 " MiB backup space remaining"}'
}


© 2018. Hetzner Online GmbH. Alle Rechte vorbehalten.