ggldrive: /zfs10-pool/subvol-103-disk-0/srv/storage/ggldrive/ rclone noauto,rw,args2env,allow_other,gid=100100,uid=101000,file_perms=0660,dir_perms=0770,config=/root/.config/rclone/rclone.conf,vfs_cache_mode=full,cache_dir=/var/cache/rclone/ggldrive 0 0
Can you elaborate a bit more on this and give a minimal working example for a CIFS share (step by step)?Another simpler way is to mount the share at the point you want it on the lxc disk from the host.
Seem to be a lot more responsive too.
You follow the first few step and instead of creating a mp in the lxc, just make the fstab mount point something like:
/zfs10-pool/subvol-106-disk-0/srv/nas-share
Once it's mounted the lxc sees it immediately and it can be mounted and unmounted from the host without restarting the container.
Just make sure permissions on the folder are right in the lxc and the share. eg fstab line:
ggldrive: /zfs10-pool/subvol-103-disk-0/srv/storage/ggldrive/ rclone noauto,rw,args2env,allow_other,gid=100100,uid=101000,file_perms=0660,dir_perms=0770,config=/root/.config/rclone/rclone.conf,vfs_cache_mode=full,cache_dir=/var/cache/rclone/ggldrive 0 0
Okay, I understand. Very clever indeed. However this will only work if your LXCs are stored on a ZFS/BTRFS volume.@TheHellSite, it's really very simple. No need for complex steps.
Just mount your cifs share the same way you normally do, but mount it under the lxc disk.
That share is then visible from the container and can be accessed as if it was part of the guest filesystem.
eg:
host # mount -t cifs -o username=<win_share_user> //WIN_SHARE_IP/<share_name> /zfs10-pool/subvol-103-disk-0/srv/<share_name>
guest # ls /srv/<share_name>
windows_files
I'm actually mounting several cloud storage devices at that location and resharing them with the guest as a windows samba server so the whole network can access those cloud storage systems with a single windows share
If you are refering to subvol names in the path , this has nothing to do with ZFS, it is the usual path of a lxc container location seen from the host.I think that many people, including me, are using ext4 (Directory) as type for their VM/LXC storage.
Why? Because ZFS on consumer grade SSDs tends to cause problems due to the lack of available cache.
Your solution makes use of a feature called "subvolumes" that not all filesystems support (f.e. ext4).
2023-12-09 19:44:08 shutdown CT 106
2023-12-09 19:44:10 starting migration of CT 106 to node 'pve1' (172.21.0.10)
2023-12-09 19:44:10 ignoring shared 'bind' mount point 'mp0' ('/mnt/lxc_shares/nas_rwx/')
2023-12-09 19:44:10 found local volume 'vmpool:subvol-106-disk-0' (in current VM config)
2023-12-09 19:44:10 start replication job
2023-12-09 19:44:10 end replication job with error: unable to replicate mountpoint type 'bind'
2023-12-09 19:44:10 ERROR: unable to replicate mountpoint type 'bind'
mp0: /mnt/share/ds718/paperless-ngx/,mp=/mnt/nas,replicate=0,shared=1
arch: amd64
cores: 4
features: nesting=1
hostname: pPlex
memory: 4096
mp0: /mnt/lxc_shares/e,mp=/mnt/e
mp1: /mnt/lxc_shares/f,mp=/mnt/f
mp2: /mnt/lxc_shares/g,mp=/mnt/g
mp3: /mnt/lxc_shares/h,mp=/mnt/h
mp4: /mnt/lxc_shares/i,mp=/mnt/i
mp5: /mnt/lxc_shares/j,mp=/mnt/j
mp6: /mnt/lxc_shares/e,mp=/mnt/lxc_shares/e,shared=1
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BC:24:11:52:57:C6,ip=dhcp,type=veth
onboot: 1
ostype: debian
rootfs: local-lvm:vm-107-disk-0,size=8G
swap: 4096
unprivileged: 1
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext4 errors=remount-ro 0 1
UUID=F2E8-1C20 /boot/efi vfat defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0
# Mount CIFS share on demand with rwx permissions for use in LXCs (manually added)
#//192.168.178.86/e/ /mnt/lxc_shares/e cifs _netdev,x-systemd.automount,noatime,uid=10000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
//192.168.178.86/e/ /mnt/lxc_shares/e cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
//192.168.178.86/f/ /mnt/lxc_shares/f cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
//192.168.178.86/g/ /mnt/lxc_shares/g cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
//192.168.178.86/h/ /mnt/lxc_shares/h cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
//192.168.178.86/i/ /mnt/lxc_shares/i cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
//192.168.178.86/j/ /mnt/lxc_shares/j cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
//192.168.178.86/ebooks/ /mnt/lxc_shares/ebooks cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
//192.168.178.86/music/ /mnt/lxc_shares/music cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
I ran into this same issue. It's a permissions issue and I fixed it with (change dir_mode and file_mode) :I have a major problem; I had Plex installed under Proxmox and Debian container as LXC.
Previously, I used to mount the SMB shares using this command:
'mount -t cifs -o rw,vers=3.0,credentials=/root/.smbcredentials //192.168.178.86/j /mnt/j.' in LXE Host
However, the share arrived in the Plex LXC container with the user group 'nobody/nogroup.'
This allowed me to at least read files in Plex (media library).
Now, for the future and to have write permissions on the SMB shares, I followed this guide and implemented the shares in fstab.
The strange thing is, the /mnt shares are correctly mounted and displayed in the command line on container 107 in Plex LXC.
But as soon as I start Plex and try to add the drives as Media Library for movies, I cannot see any files or folders.
I always bypassed the shares to the respective container under Proxmox, for example: 'pct set 107 -mp0 /mnt/j,mp=/mnt/j.'
Could it be that Plex was installed under a different user?
Is it possible to change the user rights of Plex or the container so that I can see files within the program itself?
I don't understand exactly what I did wrong.
this is 107.conf:
Code:arch: amd64 cores: 4 features: nesting=1 hostname: pPlex memory: 4096 mp0: /mnt/lxc_shares/e,mp=/mnt/e mp1: /mnt/lxc_shares/f,mp=/mnt/f mp2: /mnt/lxc_shares/g,mp=/mnt/g mp3: /mnt/lxc_shares/h,mp=/mnt/h mp4: /mnt/lxc_shares/i,mp=/mnt/i mp5: /mnt/lxc_shares/j,mp=/mnt/j mp6: /mnt/lxc_shares/e,mp=/mnt/lxc_shares/e,shared=1 net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BC:24:11:52:57:C6,ip=dhcp,type=veth onboot: 1 ostype: debian rootfs: local-lvm:vm-107-disk-0,size=8G swap: 4096 unprivileged: 1
this is fstab:
Code:# <file system> <mount point> <type> <options> <dump> <pass> /dev/pve/root / ext4 errors=remount-ro 0 1 UUID=F2E8-1C20 /boot/efi vfat defaults 0 1 /dev/pve/swap none swap sw 0 0 proc /proc proc defaults 0 0 # Mount CIFS share on demand with rwx permissions for use in LXCs (manually added) #//192.168.178.86/e/ /mnt/lxc_shares/e cifs _netdev,x-systemd.automount,noatime,uid=10000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0 //192.168.178.86/e/ /mnt/lxc_shares/e cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0 //192.168.178.86/f/ /mnt/lxc_shares/f cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0 //192.168.178.86/g/ /mnt/lxc_shares/g cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0 //192.168.178.86/h/ /mnt/lxc_shares/h cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0 //192.168.178.86/i/ /mnt/lxc_shares/i cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0 //192.168.178.86/j/ /mnt/lxc_shares/j cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0 //192.168.178.86/ebooks/ /mnt/lxc_shares/ebooks cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0 //192.168.178.86/music/ /mnt/lxc_shares/music cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=Administ,pass=pass 0 0
{ echo '' ; echo '# Mount CIFS share on demand with rwx permissions for use in LXCs (manually added)' ; echo '//NAS/nas/ /mnt/lxc_shares/nas_rwx cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=110000,dir_mode=0777,file_mode=0774,user=smb_username,pass=smb_password 0 0' ; } | tee -a /etc/fstab
Thanks for this post, extremely helpful!
One minor addition, adding ",shared=1" to the end of the bind mount line in /etc/pve/lxc/LXC_ID.conf will enable that container to be migrated across Proxmox nodes. It basically tells Proxmox to ignore the bind mounts, and without it will refuse to migrate. Of course if you don't have those CIFS mounts on the target node, I expect something would go poorly, but I didn't test that-- with the same CIFS mounts on every node it works perfectly.