proxmox

How to mount an external USB(3) drive to a LXC container

In this example we make use of a Western Digital 1TB external USB3 drive.
This device is NTFS formatted, which is easy to handle in Windows.

Our container is used for samba services and has ID 102.

At the host system (Proxmox)

– Check which device the drive has been given on the host.
lsblk (in this case ‘sdg’, partition ‘sdg1’)

– Add a mounting location
mkdir /mnt/ext-usb

– Install the ntfs-3g package
apt-get update && apt-get install ntfs-3g

– Mount the disk to the mountlocation
mount -t ntfs-3g /dev/sdg1 /mnt/ext-usb

Op LXC client (container)

– Add a mount location inside the LXC container
mkdir /mnt/ext-usb

 

At the host

– Mount the drive to the container in this example we use mp1 (check if mp1 is not allready used!)
pct set 102 -mp1 /mnt/ext-usb,mp=/mnt/ext-usb

By Stefan

2 thoughts on “Proxmox – Add external usb drive to LXC container”
  1. How can you bind mount a single usb drive to multiple lxc containers? I noticed when i perform bind mount from host to lxc1 the host can no longer see the files. when i bind mounted the same usb drive to lxc2 using the same procedure and directories no files were available (makes sense probably since they were not available to host anymore either).

Leave a Reply