Skip to main content

FTP catalog automount for proxmox

I use proxmox hypervisor to host my VM’s. My provider has ftp server to store backups. Proxmox can’t backup to ftp out of the box, but it’s debian-based and we can use curlftpfs to mount ftp catalog like any network file system. But, in my case, I had issue with ftp share in fstab – sometimes connection broken after inactivity time. Now I use systemd to automount and unmount ftp share and I think it’s simplest and very stable way to use ftp for proxmox backup.

curlftpfs

Install curlftpfs

apt-get install curlftpfs

Create password file for ftp

cat<<EOF>>/root/.netrc
machine ftp-server.com
login ftp-user
password ftp-password
EOF

Manual mount tests

mkdir /mnt/backup
curlftpfs ftp-server.com /mnt/backup -o rw,allow_root
ls /mnt/backup
fusermount -u /mnt/backup

Setup automount

Create mountpoint file for systemd

cat<<EOF>>/etc/systemd/system/mnt-backup.mount
[Unit]
Description=ftp share
[Mount]
What=curlftpfs#ftp-server.com
Where=/mnt/backup
Options=rw,allow_root,direct_io,hard_remove,big_writes
Type=fuse
[Install]
WantedBy=multi-user.target
EOF

Create mount service

cat<<EOF>>/etc/systemd/system/mnt-backup.automount
[Unit]
Description=ftp share
Requires=network-online.target
After=network-online.service
[Automount]
Where=/mnt/backup
TimeoutIdleSec=30
[Install]
WantedBy=multi-user.target
EOF

Enable and check automount

systemctl daemon-reload
systemctl enable mnt-backup.mount
systemctl enable mnt-backup.automount --now
ls /mnt/backup
mount | grep /mnt/backup