Connecting a USB drive to a LXC container expands the disk space for that container. In my case, I was able to expand a nextcloud with external space that did not need a backup.
To connect, lets start with connecting the hardware and get the ID of it. Execute the following on your PVE host.
ls -ahlp /dev/disk/by-idIt will return something like this:
Mar 15 02:02 usb-Seagate_Basic_NT22RPD8-0:0 -> ../../sda Mar 15 02:02 usb-Seagate_Basic_NT22RPD8-0:0-part1 -> ../../sda1Now permanently mount the disk to a folder by creating a service and start and enabling it. Create a file:
# vim /etc/systemd/system/mnt-pve-YOURDIR.mount [Install] WantedBy=multi-user.target [Mount] Options=defaults Type=ext4 What=/dev/disk/by-id/usb-Seagate_Basic_NT22RPD8-0:0-part1 Where=/mnt/pve/YOURDIR [Unit] Description=Mount storage 'YOURDIR' under /mnt/pveNow reload the system daemon, start the service and if it succeeds, enable it to mount it at every system startup.
systemctl daemon-reload systemctl start mnt-pve-YOURDIR.mount systemctl enable mnt-pve-YOURDIR.mountIf everything worked, you can access your USB drive via ls /mnt/pve/YOURDIR from the PVE host.
Access the configuration file of your LXC container and add line:
# vim /etc/pve/lxc/XXX.conf # Add this line lxc.mount.entry: /mnt/pve/YOURDIR path/in/container none bind,optional,create=dirThe optional enables the container to start even if the bind fails. Not the leading / in the path of the PVE folder, but the missing / in the path inside the container!
This directly maps an external disk into a container. Note, that
Last update: 2026-03-17