Hi everyone,
Thanks in advance for reading. I had about 4 TB of videos I wanted on a samba server. The samba server is an Ubuntu 22.04 LXC and is working just fine. All of the videos were on my laptop so I moved them to an external HDD, plugged it in to the server, mounted it on the pve host and copied files directly from the USB external HDD to the zfs sub-volume being used as the samba movie share.
All that worked fine, but now the files "belong" to the pve host and not the Ubuntu lxc. How do I remedy this? Preferably without having to recopy 4TB of data.
The ubuntu lxc serving as the Samba server is CT-303 and it's shared volume is /zfspool1/subvol-303-disk-0. I mounted the external hdd to /root/usb4tb on the pve host and then:
Thanks again in advance for any help.
Thanks in advance for reading. I had about 4 TB of videos I wanted on a samba server. The samba server is an Ubuntu 22.04 LXC and is working just fine. All of the videos were on my laptop so I moved them to an external HDD, plugged it in to the server, mounted it on the pve host and copied files directly from the USB external HDD to the zfs sub-volume being used as the samba movie share.
All that worked fine, but now the files "belong" to the pve host and not the Ubuntu lxc. How do I remedy this? Preferably without having to recopy 4TB of data.
The ubuntu lxc serving as the Samba server is CT-303 and it's shared volume is /zfspool1/subvol-303-disk-0. I mounted the external hdd to /root/usb4tb on the pve host and then:
Now I can 'see' the files on the container, but they don't show up on the samba share and I can't modify permissions or ownership on them. On the lxc CT-303, the files copied from the USB HDD look like filename1 and filename2. Ones copied via the network look like filename0's permissions.mv /root/usb4tb/*.mp4 /zfspool1/subvol-303-disk-0
On the host, they look like this:ls -l /shared/Movies
...
-rw-r----- 1 systemfiles allshares 15892849840 Jun 17 17:25 filename0.mp4
-rwxr-xr-x 1 nobody nogroup 23161293021 Jun 13 00:00 filename1.mp4
-rwxr-xr-x 1 nobody nogroup 11552721961 Jun 14 20:07 filename2.mp4
...
Where, once again, filename0.mp4 was copied via the network and the other two from the USB drive. Is there someway from the PVE host I can just like "delegate" these files to the container? I found this reddit post. Will this do the trick? It recommends I do the following:ls -l /zfspool1/subvol-303/disk-0
...
-rw-r----- 1 100999 101000 17702914003 Jun 25 16:02 filename0.mp4
-rwxr-xr-x 1 root root 13123613795 Jun 13 14:46 filename1.mp4
-rwxr-xr-x 1 root root 13123613795 Jun 13 14:46 filename2.mp4
...
Here is how I handle my permissions. It's mainly targeted to containers, but maybe it can help you.
# Remove all permissions
- Enable ACLs on your dataset: zfs set acltype=posixacl pool/mydataset
- Make a temporary dir: mkdir -p /pool/mydataset/demo and make it writeable for everybody with chmod a+rwx. Then write a file to it from your container or vm.
- get the UID and GID of that user who wrote the file (containers often have a UID / GID of 100000 for root) with ls -la
- Set the permissions you like via ACL: here is the script I use:
sudo setfacl -R -b /pool/mydataset/demo
sudo chown -R root.root /pool/mydataset/demo
#Set permissions of main folders
sudo setfacl -R -m u::rwX,d:u::rwX,g::rwX,d:g::rwX,o:r-X,d:r-X,u:root:rwX,d:u:root:rwX,u:100000:rwX,d:u:100000:rwX /pool/mydataset/demo
Replace the 100000 with the permissions you got with the method from above.
credit to reddit user pbengert
Thanks again in advance for any help.