Mounting an NFS share

I work with CentOS7 and SL7. So on the SL7, I have that extra HD that I want to use as common data storage for the whole cluster… How did I manage to do it?

On the SL7, I get the UUID of the disk (reference : /home/liquidat) and add the entries to the /etc/fstab

root@sl7 ~ ## > blkid /dev/sdd1 
/dev/sdd1: LABEL="data_local" UUID="some-long-stuff" TYPE="ext4"
root@sl7 ~ ## > more /etc/fstab 
UUID=one-uuid           /            ext4 defaults 1 1
UUID=other-uuid         /boot        ext4 defaults 1 2
UUID=the-third-uuid      swap        swap defaults 0 0
UUID=some-long-stuff    /data_local  ext4 defaults 1 1
/data_local             /export/data ext4 bind 0 0

So on fstab I have one entry for the UUID of my disk, and another for the /export/data folder. Don’t forget to create the folders. The options are also important. Then I need to write the export file, with the IP range I want to allow to access to my NFS share, something like this:

root@sl7 ~ ## > more /etc/exports
/etc/exports - a list of directories for NFS to export ###
/export/data 10.XXX.XXX.XXX/
(rw,nohide,insecure,no_subtree_check,sync,no_root_squash) \

Be careful with its formatting!  Here it’s not so nicely displayed.  Maybe you want to check the stack-overflow post about it. Now we simply mount the disk, mount the shares, check that they are visible and start the NFS service:

root@sl7 ~ ## > mount /data_local
root@sl7 ~ ## > ls /data_local
root@sl7 ~ ## > ls /export/data
root@sl7 ~ ## > exportfs -r
root@sl7 ~ ## > systemctl start nfs-server.service

And on the CentOS7 system, mount the share like this:

[root@CentOS7 /]# mount /data_local/

Done! Enjoy sharing…


About bitsanddragons

A traveller, an IT professional and a casual writer
This entry was posted in bits, centos. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s