0

I am setting up a RancherOS VM on my FreeNAS server and I am having trouble setting up NFS shares. I have a .yml file that is able to set up one share mount but I would like to be able to set up two separate shares. In the configuration .yml file below, I tried adding a second line for nfs-2 under volumes and then the second location I wanted to share under environment (Share2). This results in an nfs-2 share being created but not accessible outside of ssh, so essentially I can view and add/delete directories with ssh but I don't know where the directory actually is and I can't access it with SMB. The nfs-1 share mount then accesses whichever share volume is the last line under environment. If there are directories in the nfs-1 share they are viewable in ssh and I can make and remove new directories.

rancher:
  services:
    nfs:
      image: xxxxxxx/rancher-nfs-client
      labels:
        io.rancher.os.after: console, preload-user-images
        io.rancher.os.scope: system
      net: host
      privileged: true
      restart: always
      volumes:
      - /usr/bin/iptables:/sbin/iptables:ro
      - /mnt/nfs-1:/mnt/nfs-1:shared
      - /mnt/nfs-2:/mnt/nfs-2:shared
      environment:
        SERVER: 192.168.1.xxx
        SHARE: /mnt/mntVolume/rancher
        SHARE: /mnt/mntVolume/Share2

I also tried adding the SERVER line a second time before the second share which didn't change anything.

Basically, I am wondering if there is a way to edit the volumes and environment sections to be able to create one NFS share in the rancher storage pool for docker containers and config files and another in Share2 which is a storage pool of existing file share directories.

1

1 Answer 1

0

I just set up RancherOS on my FreeNAS, and needed multiple shares mounted. Here's what I did that worked. I created /var/lib/rancher/conf/cloud-config.d/multimount-cloud-config.yml with the following content:

#cloud-config
write_files:
  - path: /etc/rc.local
    permissions: "0755"
    owner: root
    content: |
      #!/bin/bash
      mkdir -p /mnt/dockershare
      mkdir -p /mnt/plex
      cloud-init-execute
rancher:
  services:
    nfs:
      image: d3fk/nfs-client
      labels:
        io.rancher.os.after: console, preload-user-images
        io.rancher.os.scope: system
      net: host
      privileged: true
      tty: true
      restart: always
      volumes:
        - /usr/bin/iptables:/sbin/iptables:ro
mounts:
- ["10.9.8.7:/mnt/big-tank/dockershare", "/mnt/dockershare", "nfs", ""]
- ["10.9.8.7:/mnt/big-tank/plexmedia", "/mnt/plex", "nfs", ""]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .