5.3.13. Mount storage to VPS using CurlFtpFS
Storages can be connected to a VPS and used just like regular directories. Data is transferred between the VPS and the storage transparently to the user, as if the storage's contents were located in a directory on the server (albeit with slower access).
Prepare
- Install CurlFtpFS on the server:
apt install curlftpfsdnf install curlftpfspacman -S curlftpfs - Create a mount directory on the server (after mounting, the contents of the storage will be displayed there):
mkdir /mnt/storageNote Instead of
/mnt/storage, you can specify any directory on the server.
Mount
Manual
For one-time manual mounting (which is not preserved when the server is restarted), use the following command:
curlftpfs -o allow_other cdnXX:ftp-password@cdnXX.backup.ukraine.com.ua /mnt/storage
In command:
cdnXX.backup.ukraine.com.ua— the FTP host address of your storage./mnt/storage— mounting directory (see above).
Automatically
Instructions for configuring automatic mounting (settings are retained after the server is restarted):
- In the home directory of the user under which CurlFtpFS will be run, create a file named
.netrcwith the following contents:machine cdnXX.backup.ukraine.com.ua login cdnXX password ftp-passwordIn the lines:
cdnXX.backup.ukraine.com.ua— the FTP host address of your storage.
- Set the permissions for the created file to
600:chmod 600 /path/to/.netrcIn the command:
/path/to/.netrc— the path to the.netrcfile you created. - Add a line like this to the
/etc/fstabfile:curlftpfs#cdnXX.backup.ukraine.com.ua /mnt/storage fuse allow_other,uid=0,gid=0,_netdev 0 0In the line:
cdnXX.backup.ukraine.com.ua— the FTP host address of your storage./mnt/storage— mounting directory (see above).
- Apply the changes without restarting the server:
mount -a
To disable automatic mounting, simply remove the added line from /etc/fstab.
Unmount
To unmount, use the following command:
fusermount -u /mnt/storage
In the command: /mnt/storage — the mount point (see above).