Difficulty connecting USB HDD XFS format inside unprivileged LXC

Jarvar

Well-Known Member
Aug 27, 2019
317
10
58
Hello everyone,
I had previously connected a USB HDD setup as a zpool and used lxc.mount.entry inside an LXC setup with Debian and Proxmox Backup Server.
I got it working but one of my other drives is a single drive and the ZFS was causing errors. I followed some recommendations to try out XFS, but now am having difficulty connecting to it inside the lxc.
I followed some suggestions and it's setup as:

lxc.cgroup2.devices.allow: c 189:* rwm lxc.mount.entry: /dev/bus/usb/002/002 dev/bus/usb/002/002 none bind,optional,create=file 0,0

Inside the lxc:

ls -l /dev/bus/usb/002/002 ---------- 1 root root 0 Jan 19 04:02 /dev/bus/usb/002/002

when I run lsusb inside the lxc it shows up, same with lsblk but I can't mount it.
Has anyone had some success?
Thank you in advance for your assistance.

Running Proxmox 8 on host and PBS 3 inside LXC installed inside Debian 12.
 
Last edited:
Can't you just mount the drive on the Proxmox host filesystem somewhere and then use a normal mountpoint for the container that points to that: https://forum.proxmox.com/threads/mount-disk-to-container.78059/ ? That is the normal way to pass (network and USB) drives to unprivileged containers (which can't mount or load filesystem drivers): https://pve.proxmox.com/wiki/Unprivileged_LXC_containers . Why try the USB passthrough to the contaienr which is not stable and does not support hot-(un)plug?
 
  • Like
Reactions: Jarvar
Can't you just mount the drive on the Proxmox host filesystem somewhere and then use a normal mountpoint for the container that points to that: https://forum.proxmox.com/threads/mount-disk-to-container.78059/ ? That is the normal way to pass (network and USB) drives to unprivileged containers (which can't mount or load filesystem drivers): https://pve.proxmox.com/wiki/Unprivileged_LXC_containers . Why try the USB passthrough to the contaienr which is not stable and does not support hot-(un)plug?
You're a genius @leesteken
Thank you!

Okay I added the bindmount

mp0: /mnt/usbpool004,mp=/mnt/usbpool004

and inside the lxc if I type df -h
it will show the correct size and mountpoint.

then I'll check permissions
Code:
ls -l /mnt/usbpool004/
total 0
drwxr-xr-x 2 nobody nogroup  6 Jan 19 03:43 dump
drwxr-xr-x 2 nobody nogroup  6 Jan 19 03:43 images
drwxr-xr-x 2 nobody nogroup  6 Jan 19 03:43 private
drwxr-xr-x 2 nobody nogroup  6 Jan 19 03:43 snippets
drwxr-xr-x 4 nobody nogroup 42 Jan 19 03:43 template
[/ICODE]

These are my UID settings
[ICODE]
lxc.idmap: u 0 100000 34
19 lxc.idmap: g 0 100000 34
20 lxc.idmap: u 34 34 1
21 lxc.idmap: g 34 34 1
22 lxc.idmap: u 35 100035 65501
23 lxc.idmap: g 35 100035 65501
[/ICODE]


Instead of adding the new UID they suggest, inside the host, I chown -R 34:34 /mnt/usbpool004
It seems like it's working now, unless I am missing something...
Is it okay to combine mp0 with several lxc.mount.entry points?

Somehow it doesn't show up when it make it an lxc.mount...
Thanks a billion!
 
Last edited: