NFS Server

Mounting a shared network drive


For some stateful services, such as Jenkins, it can be convenient to mount a shared network drive to every node. A shared network drive makes it possible to launch the task on a new node if the node in use becomes unavailable.

NOTE: This example uses CoreOS and systemd, and has not been tested in other environments.


  • These instructions are CoreOS-specific.
  • This is not an HA NFS server. It runs on a single master and should only be used as a proof of concept.
  • If you have access to a pre-existing NFS or another network store, skip to Configure the agent(s) to mount the drive .

Configure the master with the file-share

  1. Log in to the master node using the DC/OS command line interface:

    dcos node ssh --master-proxy --leader
  2. Set up a folder for NFS runtime information:

    sudo mkdir /var/lib/nfs
  3. Write an /etc/exports file to describe the folders to export. Replace the path /data with the absolute path to the export folder, and the CIDR range with an appropriate range for your subnet:

    cat /etc/exports
  4. Start rpc-mountd and nfsd:

    sudo systemctl start rpc-mountd
    sudo systemctl start nfsd
  5. Enable rpc-mountd and nfsd for automatic startup:

    sudo systemctl enable rpc-mountd
    sudo systemctl enable nfsd

Configure the agent(s) to mount the drive

  1. List nodes in the cluster:

    dcos node
     HOSTNAME       IP                         ID  68ded4c8-8808-4a41-b460-7171355b2037-S1  68ded4c8-8808-4a41-b460-7171355b2037-S0
  2. SSH to a node:

    dcos node ssh --master-proxy --mesos-id=68ded4c8-8808-4a41-b460-7171355b2037-S0
  3. Make a new folder to mount into:

    sudo mkdir /mnt/data
  4. Set up a folder for NFS runtime information:

    sudo mkdir /var/lib/nfs
  5. Create a new systemd mount unit to describe the mount. The name of the .mount file is the same as the path to the mount point, with the leading slash removed and other slashes converted to dash. Using /mnt/data as an example, the file is named mnt-data.mount. In addition, replace with the IP of the NFS host. More information can be found in the CoreOS documentation:

    cat /etc/systemd/system/mnt-data.mount
  6. Test the new mount by using touch to create a file:

    touch /mnt/data/test.txt