You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Block devices can only be mounted on one machine at a time. If you need to share some storage space across multiple VMs, you can export it via NFS from the one with that volume mounted.

Provisioning the VMs

If running the VMS at ECMWF, make sure both server and client have the private network enabled, in order to see each other.

You may want to also set up an extra volume other than the root one to use as the export. See Creating storage volumes to see how to set it up.

Installing and configuring the NFS server

  1. Install the NFS server and tools if not installed. On CentOS:

    sudo yum install nfs-utils

    On Ubuntu

  2. Configure the directory or directories to export. For example, if you want to share a directory called /data within your private tenant network (192.168.1.0/24)

    echo "/data 192.168.1.0/255.255.255.0(rw,sync,no_root_squash,no_all_squash) | sudo tee -a /etc/exports

    You may want to adapt it to suit your needs.

  3. Start the services. On CentOS:

    sudo systemctl enable rpcbind
    sudo systemctl enable nfs-server
    sudo systemctl enable nfs-lock
    sudo systemctl enable nfs-idmap
    sudo systemctl start rpcbind
    sudo systemctl start nfs-server
    sudo systemctl start nfs-lock
    sudo systemctl start nfs-idmap

    On Ubuntu:

    sudo service nfs-kernel-server restart
  4. You may need to configure the firewall to enable those services to be open. On CentOS:

    sudo firewall-cmd --permanent --zone=public --add-service=nfs
    sudo firewall-cmd --permanent --zone=public --add-service=mountd
    sudo firewall-cmd --permanent --zone=public --add-service=rpc-bind
    sudo firewall-cmd --reload
  5. Take note of the private IP of the server, as you will need it when configuring the clients

    ip addr show

Installing and configuring the NFS clients

You may now mount the share from the server

  1. Create the directory where the mount is going to go. We are using /data in this example:

    sudo mkdir /data
  2. Add an entry to your /etc/fstab. In this basic example we assume our server is on 192.168.1.1:

    echo "192.168.1.1:/data nfs defaults 0 0" | sudo tee -a /etc/fstab > /dev/null

    You may add extra options to your entry.

  3. The shared filesystem will be automatically mounted on the next reboot. To mount it straight away, you may run:

    sudo mount -av





  • No labels