[TUTORIAL] Connect automatically to SFTP Remote Storage and use it for Backup (e.g Strato HiDrive)

Toormser

Member
Jul 28, 2021
55
1
13
Community,

for my case I've been looking for a workaround to bring out my backup data weekly without creating a new pbs server remotly. For this workaround and my solution I'm using my existing external SFTP Storage from a german company Strato (Product "HiDrive). So let's rock ...

1. Login your pve shell (inside gui shell or PuTTY)
2.
Bash:
apt -y update && apt install -y sshfs
3.
Bash:
mkdir /mnt/hidrive
4. Choose your public key
5. e.g
Bash:
cat /root/.ssh/id_rsa.pub
6. Save this output to a new file on your computer and upload this key to your provider (e.g Strato HiDrive Settigs) this is mandantory for mount this storage automatically at pve booting.​
7.
Bash:
sshfs username@sftp.yourhost.com:/path/to/your/remote /mnt/hidrive

Now your storage is connected. For automatically connect edit your /etc/fstab file.

8.
Bash:
nano /etc/fstab
9. And insert in end of the file in one line the following code.

Bash:
sshfs#sshfs username@sftp.yourhost.com:/path/to/your/remote /mnt/hidrive fuse uid=1002,gid=100,umask=0,allow_other,_netdev 0 0

Please be sure, that from the code above is in one line from the fstab file.

10. Now - just for clean - reboot your pve. Your sftp storage should be connected at boot.
11. Relogin into your gui and navigate to Datacenter > Storage > Add > Directory
12. Insert ID (your storage name), Directory (/mnt/hidrive), Content (VZDump Backup File)
13. Next Tab > Backup Retention (set what ever you want)​
14. Add

Now your backup storage is in pve. You can do this for your pbs (remotly sync) as well.
 
Last edited:
  • Like
Reactions: battaglin
Bash:
sshfs#sshfs username@sftp.yourhost.com:/path/to/your/remote /mnt/hidrive fuse uid=1002,gid=100,umask=0,allow_other,_netdev 0 0

If you put that into your fstab, your Proxmox Server will not boot anymore!
The correct syntax is
Bash:
sshfs#username@sftp.yourhost.com:/path/to/your/remote /mnt/hidrive fuse uid=1002,gid=100,umask=0,allow_other,_netdev 0 0
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!