How to CIFS Mount?


#1

Hi,

has somebody managed to mount CIFS volumes in RancherOS? NFS works nicely in my configuration (see below) but CIFS does not work at all…

sudo vi /var/lib/rancher/conf/cloud-config.yml

mount -t nfs 192.168.178.123:/volume/abc /mnt/abc
mount -t cifs -o credentials=/root/.smbcredentials //192.168.178.123/bcd /mnt/bcd

Do you have any suggestions?

Best regards

Peter


#2

I don’t believe you can using the default console as no rpcbind package is present for mounting any type of remote file system.

Switching to the ubuntu-console should make this possible (as at worst you can just install the package).


#3

Hello,

I had a similar question and was struggling to get it working on our internal/private cloud. Here’s a stripped down version that will get you up and running.

#cloud-config
hostname: namehere
rancher:
   console: ubuntu
   network:
    interfaces:
      eth*:
        dhcp: true
   sysctl:
    vm.max_map_count: 262999
   services:
    rancher-agent1:
      image: rancher/agent:v1.2.2
      command: http://1.2.3.4:8080/v1/projects/1a5/scripts/the:unique:codehere
      privileged: true
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      environment:
        CATTLE_HOST_LABELS: env=test&os=rancheros
runcmd:
  - chown -R :rancher /mnt
  - chmod -R g+rw /mnt
  - apt update
  - apt install cifs-utils -y
  - sudo mount //windowsFileServer/sharename -t cifs -o username=theUserName,password=thePassWordHere /mnt
ssh_authorized_keys:
  - ssh-rsa AAA...

This line is for running Elasticsearch on the host (off topic but may be helpful to others):

sysctl:
vm.max_map_count: 262999


#4

To add more mounts you can create a yml file on rancheros like the following:

runcmd:

  • sudo mount //windowsFileServer/sharename2 -t cifs -o username=theUserName,password=thePassWordHere /mnt2

Then ‘sudo ros config merge -i moreMounts.yml’ and reboot. You can find the entry in /var/lib/rancher/conf/cloud-config.yml. This was brought to you in part by maik “No risk, no fun.” :slight_smile: and documentation.


#5

version 1.0.4, successed

#cloud-config
mounts:
- - //192.168.1.1
  - /mnt/smb
  - cifs
  - username=guest,iocharset=utf8,_netdev