This article will guide you how to connect a network hard drive to Proxmox’s LXC container, using the SMB / CIFS protocol. I am using this method to connect a folder containing movies stored on XPEnology to an LXC running Plex on Proxmox.
The operation will include 2 steps:
- Connect the network hard drive to the Proxmox host
- Connect mount folder on Proxmox host to LXC
1. Configuration on Proxmox host
You need to understand how to connect to the Samba Server as instructed below before continuing”
Create a new folder to connect to the network hard drive
mdkir /mnt/nas
Code language: Nginx (nginx)
Edit fstab
nano /etc/fstab
Code language: Nginx (nginx)
Add the following line
//100.98.213.66/usbshare2/Thuan /mnt/nas cifs _netdev,x-systemd.automount,noatime,uid=100000,gid=100000,user=,pass= 0 0
Code language: YAML (yaml)
Replace //100.98.213.66/usbshare2/Thuan
with the path corresponding to the network hard drive you need to connect. In addition, you need to add and
of network hard drive.
Parameter | Explain |
---|---|
_netdev | Notice to systemd This is a network hard drive. |
x-systemd.automount | Auto reconnect in case NAS is disconnected |
noatime | Do not update Access timestamps when folder/file is accessed |
uid=100000,gid=100000 | Grant access to declared uid/gid |
By default, user root
Unprivileged LXC containers will have the code uid=100000
and gid=100000
on Proxmox host, so this parameter needs to be declared in fstab so that LXC has access to the network hard drive.
Connect to the network hard drive using the following command
mount -a
Code language: Nginx (nginx)
2. Connect mount folder to LXC Container
The network hard drive after connection has been mounted into the folder. /mnt/nas
on Proxmox host. I will connect this folder inside LXC Container.
First, you need to shut down the running LXC. You can issue the command directly on the Proxmox host
pct shutdown
Code language: Nginx (nginx)
Next, edit the configuration file of the LXC container that needs to access the network drive.
nano /etc/pve/lxc/LXC-id>.conf
Code language: JavaScript (javascript)
Add the following line and save
lxc.mount.entry: /mnt/nas/ mnt/nas none bind 0 0
Code language: YAML (yaml)
Restart LXC
pct start
Code language: Nginx (nginx)
Access LXC, you will see the network hard drive has been successfully linked to the path. /mnt/nas
The article is based on the instructions here: https://blog.ricardof.dev/sharing-mount-unprivileged-lxc-proxmoxhas been simplified for ease of understanding.
Hope you are successful.
Comment Policy: We truly value your comments and appreciate the time you take to share your thoughts and feedback with us. Note: Comments that are identified as spam or purely promotional will be removed. To enhance your commenting experience, consider creating a Gravatar account. By adding an avatar and using the same Email here, your comments will feature a unique and recognizable avatar, making it easier for other members to identify you. Please use a valid email address so you can receive notifications when your comments receive replies.