4.3.13. Mounting storage to VPS using CurlFtpFS

Using the method described in the article, you can mount not only storage to the VPS, but also any resource that can be accessed via FTP.

Vaults you can connect to VPS and work with them as with regular directories. Data is received and transferred between the VPS and the storage invisibly to the user, as if the contents of the storage are in a directory on the server (only with slower access).

  1. Install on the server CurlFtpFS:
    apt install curlftpfs
    dnf install curlftpfs
    pacman -S curlftpfs
  2. Create a mount directory on the server (after mounting, the contents of the repository will be displayed in it):
    mkdir /mnt/storage

    Note Instead /mnt/storage you can specify any directory on the server.

For a one-time manual mount (not saved when the server is rebooted), use the command:

curlftpfs -o allow_other cdnXX:ftp-password@cdnXX.backup.ukraine.com.ua /mnt/storage

In a team:

The procedure for configuring automatic mounting (preserved when the server is rebooted):

  1. In the home directory of the user under which CurlFtpFS will run, create a file .netrc with the following content:
    machine cdnXX.backup.ukraine.com.ua
    login cdnXX
    password ftp-password

    In the lines:

  2. Set permissions for the created file 600:
    chmod 600 /path/to/.netrc

    In a team: /path/to/.netrc - path to the created file .netrc.

  3. Add to file /etc/fstab line like:
    curlftpfs#cdnXX.backup.ukraine.com.ua /mnt/storage fuse allow_other,uid=0,gid=0,_netdev 0 0

    In line:

    • cdnXX.backup.ukraine.com.ua — FTP host address your storage.
    • /mnt/storage - mount directory (see higher).
  4. Apply the changes without restarting the server:
    mount -a

To disable automatic mounting, simply remove the added line from /etc/fstab.

To unmount, use the command:

fusermount -u /mnt/storage

In a team: /mnt/storage - mount directory (see higher).