Hard-drive passthrough to LXC?

cycling-harpist

New Member
Mar 4, 2024
5
0
1
I have installed OpenMediaVault (OMV) in an LXC container (started from official debian 12.7 template and following the installation instructions for debian: https://docs.openmediavault.org/en/latest/installation/on_debian.html)

I want to let OMV control some hard-drives connected to my server.

How can I do that?

I first tried to add a "Device Passthrough" from the web UI and point it to either `/dev/sda` or `/dev/disk/by-id/ata-<MODEL>_<SERIAL>`, but I can't do anything with the drive from inside the container.

I tried editing `/etc/pve/nodes/pve/lxc/200.conf` (200 being my container id). I can see a line `dev0: /dev/disk/by-id/ata-<MODEL>_<SERIAL>` from the device passthrough above. I tried playing with those options:
```
unprivileged: 0/1
lxc.apparmor.profile: lxc-container-default-with-mounting
lxc.cgroup.devices.allow: c 8:0 rwm
```
where `8:0` is for my disk:
```
❯ ls -l /dev/sd*
brw-rw---- 1 root disk 8, 0 Oct 23 22:50 /dev/sda
```

Whatever I do, I cannot read the disk from inside the LXC container (tried with `fdisk -l /dev/sda` or with the path `/dev/disk/by-id/*`).

Is what I want to do possible at all?

Thanks!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!