Proxmox Disk Passthrough & LXC Bind Mounts
This guide explains the process of using a physical disk in a Proxmox Virtual Environment (PVE) by first passing it through to a virtual machine (VM) and then sharing a specific directory from that disk with a Linux Container (LXC) using a bind mount.
Why the need of a passthrough from a VM?
The idea was that my OpenMediaVault VM will manage the disks, raid configurations and the shared folders and users. Any permissions will be done in a nice UI (after all of this configuration)
Why an unpriviledge LXC for Jellyfin?
Jellyfin shouldn’t have root access (priviledge container) but that means that is more difficult to mount drives as it doesn’t have enough control. Using an lxc container seams that uses less resources than a full blown VM.
1. Understanding the Setup
In this configuration, a physical disk is given exclusive, direct access to a VM (in your case, an OpenMediaVault or OMV VM). This is achieved by passing the disk’s unique World Wide Name (WWN) directly to the VM’s configuration file.
-
WWN (World Wide Name): A persistent, unique identifier for a storage device. Using the WWN ensures that even if the physical device path (e.g., /dev/sda) changes after a reboot, the VM will always find the correct disk.
-
Bind Mount: A bind mount allows you to take a directory on the host system (the Proxmox server) and make it appear as a directory inside an LXC. It provides a lightweight way to share data without the overhead of a full virtualized filesystem.
2. Confirming Disk Passthrough
You can confirm that a disk is being passed through to a VM by inspecting the VM’s configuration file and the system’s symbolic links.
-
File Path: The configuration file is located at
/etc/pve/qemu-server/<VMID>.conf
(for VMs). In your case, it would be 100.conf. -
Command Output: The command
ls -l /dev/disk/by-id/
shows the symbolic link from the WWN to the physical device.
$ ls -l /dev/disk/by-id/
...
lrwxrwxrwx 1 root root 9 Aug 29 09:27 wwn-0x5000c60077355b0d -> ../../sda
...
- Configuration File: The 100.conf file contains a line similar to this, confirming the passthrough:
scsi4: /dev/disk/by-id/wwn-0x5000c60077355b0d,size=1953514584K
This line tells the VM to use the disk identified by the WWN as its scsi4 device.
3. Sharing the Disk with an LXC using a Bind Mount
Since the entire disk is owned by the VM, you must share the data from the Proxmox host after the VM has mounted it.
Step-by-Step Instructions
- Stop the LXC: Before making configuration changes, stop the LXC you want to share the disk with.
$ pct stop <LXC_ID>
-
Mount the Disk on the Proxmox Host: The disk is managed by your OMV VM, but the Proxmox host still needs to know where to access the partition. You will likely need to mount the partition on the host first.
-
Create a mount point on the Proxmox host.
$ mkdir /mnt/media_share
-
Mount the partition to the new directory. From your example, the disk partition is /dev/sda1.
$ mount /dev/sda1 /mnt/media_share
-
-
Edit the LXC Configuration: Use a text editor like nano to add a bind mount entry to the LXC’s configuration file.
-
Open the configuration file for your LXC (e.g., ID 101).
$ nano /etc/pve/lxc/101.conf
-
Add the following line to the end of the file. This creates a mount point mp0 that links the host directory
/mnt/media_share
to a new directory inside the container at/var/media
.mp0: /mnt/media_share,mp=/var/media
-
Save the file and exit the editor (Ctrl+X, Y, Enter in nano).
-
Restart the LXC: Restart the LXC to apply the changes.
$ pct start <LXC_ID>
The shared directory will now be accessible from within the LXC at the /var/media path. This is a robust way to share a large media library with a service like Jellyfin while keeping the original storage management within a VM.