Add remote shares to your VM's
We need stuff from our NAS and/or other storage devices to run our services. We can mount #nfs #smb #cifs by #fstab #sshfs #mount.
We need stuff from our NAS and/or other storage devices to run our services
See also this post, How to add remote shares or disks to Proxmox.
Fixed settings
Use dedicated entries in the /etc/fstab for stuff that are permanent. NFS is the fastest protocol.
# Make a fixed entry to fstab
10.10.10.10:/path/to/export /local_mountpoint nfs <options> 0 0
# Add some options
nas.mynet.local:/music /mnt/home/nalle/music nfs rw,hard,intr,rsize=8192,wsize=8192,timeo=14 0 0
mount /mnt/home/nalle/music
SSHFS
We can easily add files for testing by ssh, using the SFTP portion of SSH. This method is usable on Linux, Mac and Windows. Just install it
# To add a remote share
#sudo sshfs -o idmap=user [email protected]:/mnt/Data/Music ./music
sudo sshfs -o allow_other [email protected]:/mnt/Data/Music ./music
# To remove a mounted Directory
sudo fusermount -u ./music
Mount
Make sure you have nfs-utils installed.
# To mount a remote Directory (here a NFS share)
sudo mount -t nfs 192.168.1.40:/mnt/Data/Music ~/NFSmount
# To remove a mounted Directory
sudo umount ~/NFSmount
Mounting in Docker-Compose
In your containers docker-compose.yml file you can add volumes and point to your NAS or storage device.
...
services:
myservice:
...
volumes:
- type: volume
source: my_music
target: /nfs
volume:
nocopy: true
volumes:
my_music:
driver_opts:
type: "nfs"
o: "addr=10.10.10.10,nolock,soft,rw"
device: ":/mnt/data/music"