Wednesday, July 10, 2019

[SOLVED] Mounting external USB drive to Proxmox LXC Container

I needed to mount an external USB drive directly to an LXC container.  On initial research, this process seems simple enough.

I am using Ubuntu / Debian for this guide.

Basically I do the following to get it mounted on the Proxmox Hardware Node first:

mkdir /mnt/mountpoint
chmod -R 777 /mnt/mountpoint (this is optional)
mount /dev/bus/usb/001/004 /mnt/mountpoint

BUT! when I tried to use it in the LXC container I got 'READ ONLY' permission issues. Some error message like this:

Read only filesystem!

So I did a lot more research and found many people have similar issues. I wasted 30 minutes trying different suggestions until I found one that worked.  The solution is the fact that linux was mounting the partition as fat32 / exfat. Therefore it could not perform Read and Write.  Here is the solution that worked for me...

STEP 1 - INSTALL ntfs-3g

sudo apt-get update
sudo apt-get install ntfs-3g

STEP 2 - MOUNT using NTFS file system type (my usb drive is at USB 001:004)

mkdir /mnt/mountpoint
chmod -R 777 /mnt/mountpoint (this is optional)
mount -t ntfs-3 /dev/bus/usb/001/004 /mnt/mountpoint

STEP 3 - CHECK IF YOU CAN READ & WRITE

cd /mnt/mountpoint
touch test

If step 3 did not produce any error and you can clearly see file 'test' being created, then you are good to go.

Next you just need to add one line to your LXC container configuration to set the mountpoint.

nano /etc/pve/lxc/123.conf   (assuming 123 is your CT ID)

No comments:

Post a Comment