وبلاگ رسانگار
با ما حرفه ای باشید

سرور مجازی NVMe

آموزش سفارش و استفاده از StorageBox هتزنر

0 605
زمان لازم برای مطالعه: 9 دقیقه

Storage Box

Storage Boxes from Hetzner Online provide a safe and convenient way to store your data in our German data centers.

With our Storage Boxes, you can access your files at any time and from any place with an internet connection. It is also easy to connect Storage Boxes to your own drive on your PC and to access Storage Boxes with your smartphone and/or tablet. Hetzner Online Storage Boxes work with a variety of standard protocols, which are supported by a wide array of apps.

Various Storage Box classes allow you to choose the storage option that is best for your specific needs. And you can always upgrade or downgrade your Storage Box.

Reliability

Your files on Storage Boxes are safeguarded with a RAID configuration which can withstand several drive failures. Therefore, there is a relatively small chance of data being lost. Please note, however, that you are responsible for your data and there is no guarantee from Hetzner against potential loss of data. The data is not mirrored onto other servers.

General Information

The speed at which your data can be transferred to your Storage Box is dependent on how many other customers simultaneously attempt to access the same server. If the transfer takes too long, it is best to try doing the upload at another time of day.

It is very important to use the DNS name (<username>.your-storagebox.de) instead of the IP address for your Storage Box; this is because the IP address can change. With the DNS address, you can access your Storage Box via IPv4 and IPv6.

It is not possible to create the directories “/etc” and “/lib” on Storage Boxes.

Access to Storage Box

FTP/FTPS

You can access your Storage Box by using FTP. Please use your assigned hostname (<username>.your-storagebox.de), username, and password. Please note that an FTP connection is unencrypted; only FTPS (FTP+FTPS) is encrypted.

Active and Passive Modes

FTP protocol is built upon two connections: the first connection, via port 21 for all commands, and the second, for the transfer of all file content. The second connection can be differentiated into active and passive modes. With the active mode, the ftp server attempts to establish a connection to the client (server -> client). However, this can be blocked with the client’s firewall, and a timeout may occur. As a solution to this problem, you can use the passive mode. With the passive mode, a connection is built from the client to the server (client -> server). The method for activating the passive mode differs between different client programs. For that reason, you should check the help guides of your program.

Instructions

Windows

In Windows, use the following instructions to add your Storage Box as a network address via FTP:

  1. Open Windows Explorer.
  2. Windows 7: On the left, click on “Computer” and then at the top on “Add a network location”.
    Windows 8/10: On the left, click on “This PC”. Finally, at the top, click on “Computer” and then on “Add a network location”.
  3. Now click in the new dialog two times on “Next”.
  4. Now enter “ftp://<username>.your-storagebox.de” in the text field and click on “Next”.
  5. Unclick “Log in anonymously” and enter the name of your Storage Box.
  6. Click two times on “Next” and then on “Finish”.
  7. Enter your username and password in the open window. Alternatively, you can save your password from Windows.
  8. After clicking on “Log on”, you will be able to access your Storage Box under “This PC” (Windows 8.1/10) or “Computer” (Windows 7/8).

Software

Please note that this text only addresses a limited selection of software that can be used for this protocol.

Windows

  • Windows Explorer
  • FileZilla
  • WinSCP

Linux

  • FileZilla
  • ftp
  • ncftp
  • lftp

Android

  • AndFTP
  • ES File Explorer

SFTP/SCP

By using SFTP and SCP, you can access your Storage Box. This is completely encrypted.

Authentication Using SSH Keys

If you access your Storage Box by using SFTP/SCP, you can also authenticate yourself with a public key. Further information and an example are available on the following wiki site: Backup Space SSH Keys.

Connection Error

11: Application Error

If you receive this error while connecting via SFTP or SCP, then that is the result of the SSH key forwarding. Please deactivate the forwarding and try again.

Software

Please note that this text only addresses a limited selection of software that can be used for this protocol.

Windows

  • WinSCP (SFTP)
  • FileZilla (SFTP)

Linux

  • scp
  • sftp
  • FileZilla (SFTP)

Android

  • ES File Explorer (SFTP)
  • AndFTP (SFTP)

SAMBA/CIFS

It is also possible to connect to your Storage Box via Samba/CIFS. To do this, you can use the following UNC path: (Please note that the share name ‘backup’ is mandatory.)

\\<username>.your-storagebox.de\backup

If you use a FritzBox Router from AVM then it is necessary to deactivate the NetBIOS filter to use Samba/CIFS. Please see point 3 of this page for more information.

Instructions

Linux

In Linux-based systems you can use the following command on the CLI to mount the file system:

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

By adding the following line to /etc/fstab, your system will automatically mount the file system at boot. (It is a single line!):

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

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

username=<username>
password=<password>

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

apt-get install cifs-utils

Windows

In Windows, use the following instructions to connect your Storage Box as a network drive with its own drive letter:

  1. Open Windows Explorer.
  2. Windows 7: On the left, click on “Computer” and then at the top on “Map network drive”.
    Windows 8/10: On the left, click on “This PC”. And then at the top click on “Computer” and then on “Map network drive”.
  3. In the new dialog, select a network drive letter of your choice and enter \\<username>.your-storagebox.de\backup for the folder. Enter a check next to “Reconnect at login” if you want to automatically establish a connection upon starting the system.
  4. When you are asked for login information, you should here enter the username and password you used for your Storage Box. Optional, you can save the login information in Windows.
  5. The setup of your Storage Box as a network drive is now finished and can be found as separate drive under “This PC” (Windows 8.1/10) or “Computer” (Windows 7/8).

Error with files larger than 4 GB

If there are errors when copying files that are 4 GB or larger, then it can help to deactivate caching. To do so, the storage box must be mounted with the extra parameter ‘-o cache=none’.

WebDAV

You can access your Storage Box by using WebDAV; through this connection, it is encrypted.

By default, WebDAV for Storage Boxes is deactivated. You can activate it for free via the Robot. Please note that it can take a few minutes after the activation before your Storage Box will be accessible via WebDAV.

Unfortunately, the WebDAV protocol does not support the output of the available memory and it may produce false values. Please use sftp instead as is described in Determining available memory.

Instructions

Linux

To create a link to the WebDAV directory, use the following command:

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

By adding the following line to /etc/fstab, your system will automatically mount the file system at boot. (It is a single line!):

https://<username>.your-storagebox.de /MOUNTPOINT davfs rw,uid=<systemuser>,gid=<systemgroup>,file_mode=0660,dir_mode=0770,_netdev 0 0

In order to be able to automatically mount the WebDAV directory, enter the following line in the file /etc/davfs2/secrets:

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

In Debian-based distributions, the command davfs is provided via a package of the same name:

apt-get install davfs2

Windows

In Windows, use the following instructions to connect to your Storage Box via WebDAV:

  1. Open Windows Explorer.
  2. Windows 7: On the left, click on “Computer” and then at the top on “Map network drive”.
    Windows 8/10: On the left, click on “This PC”. And then at the top click on “Computer” and then on “Map network drive”.
  3. Click on “Connect to a Web site that you can use to store your documents and pictures”.
  4. In the new assistent, click on “Next”.
  5. Select “Choose a custom network location” and click on “Next”.
  6. Under “Internet or network address” enter the address of your Storage Box with the protocol https (For example: https://<username>.your-storagebox.de) and click on “Next”.
  7. Now you can assign a new name for the network address under the one that should be visible in Windows. Then, click on “Next”.
  8. Now click on “Finish”.
  9. Now enter the user name and password of your Storage Box in the login dialog.
  10. The setup of your Storage Box as a network address is now finished and can be found under “This PC” (Windows 8.1/10) or “Computer” (Windows 7/8).

Software

Android

  • ES File Explorer

Errors in Files Larger than 50 MB (Windows)

If you see the following error message during a copying process from Windows to a WebDAV directory, it is likely caused by a file that is larger than 50 MB:

The file size exceeds the limit allowed and cannot be saved.

This is blocked by a security setting in Windows. The following link demonstrates how you can remove this limit: https://support.microsoft.com/en-us/kb/900900

SSH / rsync / BorgBackup

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

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

Important note: For SSH key authentication, you must save a public SSH key in normal OpenSSH format on your storage box. 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 storage box. To address directories or files on the storage box, we therefore recommend that you use relative paths. For example, to download the file /server1/full_backup.tar.gz from the storage box, 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 and duplicate backups of your storage box. You can find a guide for how to do this at BorgBackup.

rsync

You can use rsync to synchronize the current state of your file directories to your storage box. For example, to synchronize a local directory to the storage box, you can use rsync as follows:

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

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

rsync --progress -e 'ssh -p23' --recursive <username>@<username>.your-storagebox.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 SCP via port 23. To upload a file via SCP, you can execute the following command:

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

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

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

SFTP

Accessing your storage box 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-storagebox.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

Determine available disk space

The amount of available disk space can be displayed on the Robot. Please note that the usage is updated approximately every 10 minutes.

To determine in a script how much available disk space you have, use the program “sftp” in Linux-based systems:

echo "df"     | sftp <username>@<username>.your-storagebox.de
echo "df -h"  | sftp <username>@<username>.your-storagebox.de
echo "df -hi" | sftp <username>@<username>.your-storagebox.de

Snapshots

Snapshots are full images of a storage box. These can be created via the Robot under Storage Boxes. A snapshot does not need any space when it is created. It grows as files are changed or deleted. No space is required for newly added files in the snapshot. The storage space consumption of the snapshots is calculated with the storage capacity of the storage box.

The storage box can be reset to the state of a snapshot. This restores changed and deleted files, while new files are deleted. Also, all snapshots that are newer than the snapshot which was restored to, are deleted. The restored snapshot and all older ones are retained.

Access to Snapshots

Access to a snapshot is possible via the directory “/.zfs/snapshots” on the storage box, if activated in the Robot. In this directory, there is a subfolder for each snapshot that maps the storage box at the time of the snapshot. Individual files or entire directories can be downloaded as usual. It is not possible to write to the “/.zfs” directory or its subfolder.

Automatic Snapshots

Via the Robot it is possible to automatically create snapshots according to a defined schedule. The schedule can be setup to create daily, weekly, or monthly snapshots. The time, day of the week, and day of the month are freely selectable. When the limit of automatically created snapshots has been reached, the oldest snapshot is automatically deleted to allow a new snapshot to be created. Automatically created snapshots can be accessed just like normal snapshots.

Upgrade and Downgrade

An upgrade or downgrade to another storage box is possible at any time without data loss. The access data remains the same. A downgrade is only possible if less space is used than what would be available after the downgrade.

Additional users / sub-accounts

Additional users can be created for a storage box via Robot. FTP, FTPS, SFTP, SCP, SMB/CIFS, HTTPS, and WebDAV are all available as protocols for these users. Access is only possible to a subdirectory of the main user and uses the storage space of the main user. The main user will have complete access to the directories of all sub-accounts.

Deleting the directory of a sub-account is only possible if the sub-account has first been deleted via Robot.

Furthermore, it is possible to set a sub-account to read-only. No files can be uploaded or deleted. Downloads are still possible.

FTP/SFTP/SCP

As is usual, it is possible to use FTP, SFTP, and SCP to gain access to the sub-accounts. However, it is necessary to use the username for the sub-account.

SMB/CIFS

For SMB/CIFS, it is necessary to use a username and a special Share. The path for this looks like the following:

Linux/Unix: //<username>.your-storagebox.de/<username>
Windows: \\<username>.your-storagebox.de\<username>

HTTPS/WebDAV

For HTTPS and WebDAV access, it is necessary to use the username for the sub-account as well as the sub-account’s DNS address:

https://<username>.your-storagebox.de

SSH / rsync / BorgBackup

With rsync, SCP, SFTP, and Borg, you can access your storage box via port 23 as usual. Use the user name of the sub-account. You can find the documentation here.

امتیاز شما به این مطلب
دیدگاه شما در خصوص مطلب چیست ؟

آدرس ایمیل شما منتشر نخواهد شد.

لطفا دیدگاه خود را با احترام به دیدگاه های دیگران و با توجه به محتوای مطلب درج کنید