Adding a bind mount using a remote folder using SSHFS.

I wanted to add a bind mount to a container so I could index the content for playback. This would allow the program in the container to index the data without the need to store it locally. The media is my music library. I want to be able play it while driving and while at work.

This became a multistage process. First I had to mount the remote folder in my Proxmox host. Then I needed to provide that folder as a bind mount in the container where the program that needed the data that ran.

The two steps are to use a secure method to talk to the remote computer. I used SSHFS to contact the server and mount the connection in the PVE host. I used the root /root folder to store the SSH keys and the config file. I edited the /etc/fstab file to fuse mount the remote share using the keys and the config file..l

First you set up your Proxmox host, the PVE environment with the SSHFS mount in the /etc/fstab. Mount the SSHFS device into a folder such as /media/folder or /mnt/folder

Ensure that the container has the proper folder created too. This way you mount from the SSHFS mount in the PVE host and the folder where you want to mount it in the container exists. Once this is done, you should take note of the path and folder in the container, and shut the container down.

Then in the host you should use the following command as an example.

sudo pct set 100 -mp0 /media/nas/audiobooks,mp=/media/AudioBooks/

Note: no spaces between the first audiobooks and mp=

For container 100 you are setting mp0 to /media/nas/audiobooks and mounting it in the container under /media/AudioBooks.

Obviously change your container number to whatever container ID corresponds to your container. And the path/folder names much match too.

Remember, the best solution is to shut down the container before hand. Also verify your work.