CIFS Shares on Proxmox and LXC
This guide provides clear steps on how to mount a CIFS (Common Internet File System) share directly to a Proxmox host and then make that share accessible within an LXC (Linux Container) on the same host.
1. Mount the CIFS Share to the Proxmox Host
Mount the network share to a designated directory on the Proxmox host.
mount -t cifs //192.168.1.111/video /mnt/myNas -o vers=3.0,username=someuser,password=somepassword
Explanation of the command:
mount -t cifs
: Specifies that you are mounting a CIFS (SMB/Samba) filesystem.//192.168.1.111/video
: This is the network path to the CIFS share.192.168.1.111
: Replace with the actual IP address or hostname of the NAS/server.video
: Replace with the actual name of the share you want to mount.
/mnt/myNas
: This is the local mount point on the Proxmox host. You can choose any suitable empty directory, but/mnt/myNas
is a common convention. Ensure this directory exists (e.g.,mkdir /mnt/myNas
).-o vers=3.0,username=someuser,password=somepassword
: These are the mounting options.vers=3.0
: Specifies the SMB protocol version to use. Version 3.0 or higher is generally recommended for better performance and security. Adjust if your NAS requires a different version (e.g.,2.1
,1.0
).username=someuser
: Replacesomeuser
with the actual username required to access the CIFS share.password=somepassword
: Replacesomepassword
with the actual password for the specified username.
Important Note: For persistent mounts that survive reboots, add an entry to /etc/fstab
on your Proxmox host.
2. Connect the CIFS Share to an LXC Container
Once the share is mounted on the Proxmox host, you can bind-mount it into your LXC container.
pct set 101 -mp0 /mnt/myNas/,mp=/mnt/myNasData
Explanation of the command:
pct set 101
: This command is used to modify the configuration of an LXC container.101
: Replace with the actual ID of your LXC container.
-mp0
: This option specifies a mount point for the container. The0
indicates the first mount point (you can add more with-mp1
,-mp2
, etc.)./mnt/myNas/
: This is the source path on the Proxmox host where the CIFS share is mounted. The trailing slash/
is important.mp=/mnt/myNasData
: This specifies the destination path inside the LXC container where the shared data will be accessible. You can choose any suitable directory within the container.
After running this command, the LXC container will automatically have the shared directory mounted at /mnt/myNasData
after a restart or if the container is currently stopped and then started. If the container is running, you may need to restart it for the changes to take effect.