Import Disk to LXC
Attach a physical disk to an existing LXC container on the Proxmox host. ProxMenux detects free disks, optionally formats them with a supported filesystem, and wires the partition to a mount point inside the container using persistent device paths.
VM passthrough vs LXC passthrough
How the script runs
The flow has two phases with clear separation between "collecting information and decisions" and "actually changing the container config". Until the final confirmation, nothing is mounted into the CT.
┌─────────────────────────────────────────────┐
│ PHASE 1 — Pick CT, detect disk, plan │
│ (nothing touched yet) │
└──────────────────┬──────────────────────────┘
▼
pct list — user picks target CT
(containers from OCI images not listed)
│
▼
Privileged check
├─ unprivileged: 1 in config
│ → offer to convert now
│ (edits /etc/pve/lxc/<CTID>.conf,
│ writes unprivileged: 0)
│ ├─ accept → continue
│ └─ cancel → abort
└─ privileged → continue
│
▼
Detect disks on host (lsblk)
│
▼
Visibility filter
├─ Hidden: mounted (root included),
│ host LVM, ZFS members,
│ active RAID members
├─ Hidden: already in this CT's config
├─ Shown with ⚠ In use: referenced by
│ another VM / CT
└─ Shown with ⚠ RAID / LVM label
│
▼
User selects one or more disks
│
▼
For each selected disk:
├─ Used by a running VM/CT → skip
├─ In a stopped VM/CT → confirm
├─ RAID member → refused
├─ Filesystem on the first partition?
│ ├─ yes → use as-is or format
│ └─ no → format
│ (format: pick ext4 / xfs / btrfs
│ + confirm data loss)
└─ Mount point path
(suggested: /mnt/disk_<device>)
│
┌──────── Cancel OR Answer all ─┐
▼ ▼
Exit, nothing ┌─────────────────┴─────────────────┐
was changed │ PHASE 2 — Apply │
└─────────────────┬─────────────────┘
▼
If conversion was accepted:
└─ rewrite CT config line:
unprivileged: 1 → 0
│
▼
If formatting was chosen:
├─ no partition → parted mklabel
│ gpt + mkpart 0% 100%
└─ mkfs.<fs> <partition>
│
▼
Resolve best persistent partition
path (/dev/disk/by-id/...-partN)
│
▼
Find next free mpN index
(scans pct config output)
│
▼
xfs / btrfs: install xfsprogs or
btrfs-progs inside the CT
(offers to start it if stopped)
│
▼
pct set <CTID> -mpN \
<persistent-part-path>, \
mp=<mount-point>, \
backup=0,ro=0[,acl=1]
│
▼
Verify: pct config <CTID> shows
the new mpN entry
│
▼
Container sees the directory at
the chosen mount point pathProxMenux hides the root disk and other mounted disks, ZFS members, active RAID members, disks used by host LVM and disks already in this container. Disks referenced by another VM or CT are shown as ⚠ In use, and RAID / LVM signatures show a ⚠ label.
Prerequisites
- At least one LXC container defined on the host.
- The container is privileged, or you accept the script's offer to convert it.
- At least one physical disk not in use by the host.
Privileged container required
unprivileged: 1, it offers to edit /etc/pve/lxc/<CTID>.conf in place. This changes the security model and does not remap existing file ownership. Back up the container and verify ownership before accepting, or rebuild it as privileged.Step-by-step
Pick the target container
ProxMenux lists the LXC containers on the host (pct list), except those created from an OCI image, whose paths are managed in the OCI manager. Pick the one that will receive the disks. If the container is unprivileged you are offered to convert it now.
Container selection menuPick the physical disk
Only safe candidates are shown, and you can select several disks in one run. For each disk, a running VM or CT that uses it skips the disk, a stopped one asks you to confirm, and a RAID member is refused.
Free disks detected on the host (with ⚠ labels for stale metadata)Format or reuse
For each selected disk the script inspects the first partition:
- If it already has a filesystem, you choose to use it as-is (existing files are preserved) or format it.
- If it has no filesystem, it is formatted: pick ext4 / xfs / btrfs. Formatting always asks for one more confirmation.
Pick the mount point
Type the path where the container should see the disk. ProxMenux suggests /mnt/disk_<device> (for example /mnt/disk_sdb) and adds a suffix if that path is already in use. This is the path inside the container; the host refers to the partition through /dev/disk/by-id/….
Attach and verify
ProxMenux appends a fresh mpN: entry to the container config, skipping indexes already in use, and re-reads the config to confirm. For xfs and btrfs it also installs xfsprogs or btrfs-progs inside the container, offering to start it if it is stopped. If the container is running the mount is exec'd live; otherwise it takes effect on the next start.
Assignment to CT
Mount point created and verifiedManual equivalent
The script wraps pct set. A direct invocation for a single disk looks like:
# find the partition's persistent path
ls -l /dev/disk/by-id | grep part1 | grep sdb
# format (only if the disk is new or unreadable)
mkfs.ext4 /dev/disk/by-id/ata-WDC_WD40EFAX-68JH4N0_WD-WX11D1234567-part1
# attach to CT 101 as mp0 at /mnt/data
pct set 101 -mp0 /dev/disk/by-id/ata-WDC_WD40EFAX-68JH4N0_WD-WX11D1234567-part1,mp=/mnt/data,backup=0,ro=0
# verify
pct config 101 | grep -E '^mp[0-9]+:'Important considerations
- Several disks per run: select them together in the checklist; each one gets its own mount point.
- Do not attach the same partition to several containers that might mount it simultaneously — concurrent writes corrupt the filesystem.
- Old metadata: disks with ZFS signatures are hidden and RAID members are refused. Clear that metadata first with the Format / Wipe Physical Disk tool.
Troubleshooting
"Cannot continue with an unprivileged container"
/etc/pve/lxc/<CTID>.conf.bak and replaces unprivileged: 1 with unprivileged: 0. That flag change alone does not convert the UID/GID ownership of existing files, so back up the container and fix the ownership first; alternatively, restore or rebuild the container as privileged.Permissions inside the container are wrong
root:root. If the service runs as another user (e.g. www-data for Nextcloud), inspect its UID/GID and adjust the required files with chown/chmod. Changes also affect the underlying disk.Related
- Import Disk to VM — equivalent flow for VMs.
- LXC Mount Points (Host ↔ CT) — share host directories with a CT instead of attaching a whole disk.
- VM and CT Management commands — pct config / push / pull reference.
- Disk Manager overview.