Parallel Computing: Quick Guide to Configuring NFS

Providing common shared storage is an important part of parallel computing. Being able to share files between compute nodes in a parallel cluster is key to getting a parallel job done. This is a follow-up article on configuring OpenMPI for Parallel Computing. You need to do this to get other nodes to play in your cluster. So, let’s get started.

For the Server:

  1. Install necessary packages. This is to install the NFS packages and its dependencies such as portmapper.
    yum install nfs-utils nfs-utils-lib portmap
    
  2. Install Dependencies. Ensure NFS-related services are started and start-up by default. These assume the RedHat-way of doing things. This will vary depending on your Linux distribution.
    /sbin/chkconfig portmap on
    /sbin/chkconfig nfs on
    /sbin/chkconfig nfslock on
    /sbin/service portmap start
    /sbin/service nfs start
    /sbin/service nfslock start
    
  3. Share Drive. Configure the directory or drive you want to share and edit the /etc/exports file. Then inform NFS that you have created a shared drive.
    mkdir /share
    cat "/share *(rw, no_root_squash,sync)" >> /etc/exports
    exportfs -ra
    
  4. Configure your security. This involves setting your hosts.allow and hosts.deny files. But, I prefer just setting the firewall. So edit your /etc/sysconfig/iptables file and add the following lines.
    -A RH-Firewall-1-INPUT -p tcp -m tcp -s 10.11.81.0/24 --dport 2049 -j ACCEPT
    -A RH-Firewall-1-INPUT -p udp -m udp -s 10.11.81.0/24 --dport 2049 -j ACCEPT
    -A RH-Firewall-1-INPUT -p tcp -m tcp -s 10.11.81.0/24 --dport 111 -j ACCEPT
    -A RH-Firewall-1-INPUT -p udp -m udp -s 10.11.81.0/24 --dport 111 -j ACCEPT
    

For the Client:

  1. Install necessary packages. This is to install the NFS packages and its dependencies such as portmapper.
    yum install nfs-utils nfs-utils-lib portmap
    
  2. Install Dependencies. Ensure NFS-related services are started and start-up by default. These assume the RedHat-way of doing things. This will vary depending on your Linux distribution.
    /sbin/chkconfig portmap on
    /sbin/chkconfig nfslock on
    /sbin/service portmap start
    /sbin/service nfslock start
    
  3. Configure Filesystem Table. Edit your system’s fstab to ensure that this directory is mounted immediately on boot. Just as a warning make sure your uids across the systems are uniform.
    10.11.81.49:/share      /share       nfs        rw,exec       0 0
    
  4. Mount drive. You can either reboot your system or type the following command:
    mount /share
    

That is it. Pretty simple right? Now you have a shared drive amongst the different machines in your parallel cluster to run your parallel computing programs.

Leave a Reply