Mount samba share inside an OpenVZ container

PDF
How to mount a samba share inside an OpenVZ container? cifs/smbfs is not virtualized therefor the mount command won't work and you can't just mount a samba share inside a container:
mount -t cifs [sambashare] [mountpoint]
this will result in a failure:
mount error: cifs filesystem not supported by the system
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
though there is a workaround, the trick is to use 'Bind Mounts' which can be used to make directories on the hardware node visible to the container.

On the node mount the samba share mount -t cifs //server/share /mnt/mymountpoint and use mount bind to make this share available for the container. First create a directory inside the container where you want to mount the share to. I.e. you want to make the share available for container-id 103 on directory /mnt/mymountpoint
Execute the following commands on the hardwarenode:
vzctl exec 102 mkdir /mnt/mymountpoint
mount --bind /mnt/mymountpoint /vz/root/102/mnt/mymountpoint
The samba share is now available inside container id 102
You can also edit /etc/fstab
\\server\share  /mnt/mymointpoint  cifs  password=[password],username=[username],noauto  0  0
/mnt/mymountpoint /vz/root/102/mnt/mymountpoint bind defaults,bind 0 0
 

Search






You are here: Home Howtos and FAQs Virtualization Mount samba share inside an OpenVZ container