What is the best-practice to add SMB shares to a Proxmox lxc? reddit / selfhosted ---------------------------------------------------------------------- DatJonas01 路 2023-12-26 16:33 Hi everyone, I run a VPS with Proxmox and want to add additional storage to one of my lxc hosts. The storage need is mostly static data (syncthing for my personal files, paperless-ngx media, eventually Immich photographs) that exceeds the storage capacity of my VPS. I got myself a 1TB Hetzner Storage Box and want to add it to my VPS. Now I am wondering what is the prefered option: 1. Add the Storage Box as a SMB share in Proxmox and add it as a mount point to the lxc container. This creates a .raw virtual file system on the SMB share. The advantage I see using this approach is that I can then use proxmox's backup feature or migrate the virtual disk in case I get myself a NAS. 2. Mount the Storage Box inside the lxc via /etc/fstab. This would mean that I could directly access my files on the Storage Box by accessing it from another device. However, it makes migrating to another storage location more difficult. What would you suggest as a best practice in this case? ---------------------------------------------------------------------- cavernerg 路 2023-12-26 16:59 I tried option one , but I keep running into issues with permissions. On host I can read/write the SMB. But inside Lxc (unprivileged) not. All googling (chown 100000 and so on) led to nothing. Option 2 would require privileged lxc ---------------------------------------------------------------------- Anejey 路 2023-12-27 07:06 You can get around the permissions issue by mounting the SMB share on the host with the proper user. I'll just copy-paste the guide from my notes, but not sure how the formatting will hold. # HOST **Edit fstab** ```text-plain //NAS/nas/ /mnt/lxc_shares/nas_rwx cifs _netdev,x systemd.automount,no atime,uid=100000,gid=110000,dir_mode=0770,file_mode=0770,user=smb_user name,pass=smb_password 0 0 ``` > What this does, is mount the CIFS/SMB share onto the host with the UID/GID that corresponds to the root inside LXC **Create a mountpoint to the LXC** `pct set VMID -mp0 /mnt/host,mp=/mnt/VM` # LXC **Add the SMB group, with the GID of 10000** `groupadd -g 10000 smb` **Add whatever user needs access to the share to the group** `usermod -aG smb USERNAME` ---------------------------------------------------------------------- cavernerg 路 2023-12-27 16:11 Awesome. This did the trick. And I tried maaany guides 馃槀 ---------------------------------------------------------------------- cavernerg 路 2023-12-27 18:05 And the next issue - postgres won't use smb volumes properly ... Maaaahhhhhh... 馃ゴ Searching for next workaround