Introduction
GlusterFS is a scalable network file system that can be used for tasks that use a lot of data, like cloud storage and streaming media. The NFS (Network File System) protocol is a common way to share files over a network, and GlusterFS supports it. This guide will show you how to use the NFS client to mount GlusterFS volumes. If you don’t know much about, this might seem be hard, but with this guide, ‘ll soon see that it’s easy.
Prerequisites
- Installed and set up the GlusterFS cluster, and set up the GlusterFS volume to export to NFS clients.
- In this article, we’ll show how to share the “glsfsvolume” volume that we already set up in previous article “GlusterFS Installation on Ubuntu 22.04.” Please read the linked article to learn how to set up a GlusterFS cluster and create a volume.
- The server where you want to mount the GlusterFS volume must have an NFS client installed. We have Linux system client for this demonstration.
- All systems clients as well as servers need to have root or sudo access.
Export GlusterFS Volume Over NFS
To mount the volume, we ‘ll need to check volume information and also if volume is enabled for nfs export. Running the following command on any of GlusterFS cluster host, we can find out about the volume.
$ sudo gluster volume info
Volume Name: glsfsvolume
Type: Replicate
Volume ID: 1336572f-5bcb-4cbc-868f-38e39a2c1fa9
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 3 = 3
Transport-type: tcp
Bricks:
Brick1: glsfshost01:/glsvol01/brick01
Brick2: glsfshost02:/glsvol01/brick01
Brick3: glsfshost03:/glsvol01/brick01
Options Reconfigured:
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
As from above output nfs.dibale is one we need to ensure that our GlusterFS volume is exportable over NFS to client. Use the following command on the volume to set nfs.disable to off.
$ sudo gluster volume set glsfsvolume nfs.disable off
Install nfs-common utilities on GlusterFS cluster nodes if cluster is created on Debian based OS distribution.
$ sudo aptitude install nfs-common -y
Mount GlusterFS Volume using NFS Client
Firstly, make sure that the NFS client utilities are installed on client system.
For Ubuntu:
$ sudo apt install nfs-common -y
For CentOS/RHEL:
$ sudo yum install nfs-utils
Mounting the GlusterFS volume using the NFS client is the next step now that the essential configuration has been completed. Start the process with the following command using GlusterFS host glsfshost01 to mount glsfsvolume on /nfsmountdir. We can use IP of GlusterFS host also.
$ sudo mount -t nfs -o mountproto=tcp glsfshost01:/glsfsvolume /nfsmountdir
It is necessary to use ‘-o mountproto=tcp’ in this situation because the Gluster NFS server does not support the UDP protocol. The following message will occur if the NFS client you are utilizing is set to connect using UDP as its default. Note that access to gluster volumes can be gained through the usage of NFS version 3.
mount.nfs: requested NFS version or transport protocol is not supported
To ensure if volume is mounted successfully, use the ‘mount’ and ‘df -h’ command to check mounted file system and view the mount point.
$ sudo mount
$ sudo df -h
To automatically mount nfs share on the client at boot time edit ‘/etc/fstab’ and put the below entry.
glsfshost01:/glsfsvolume /nfsmountdir nfs defaults,_netdev,mountproto=tcp 0 0
Gluster is compatible with the default approach used by Linux for automounting NFS mounts. Restart the autofs service after making any necessary changes to the /etc/auto.master and /etc/auto.misc files. After that, the directory will be mounted in the background whenever a user or process tries to access it for the first time.
Conclusion
Mounting a GlusterFS volume using an NFS client is something that has been discussed in detail throughout this tutorial. After completing the prerequisites, we moved on to the process of establishing a GlusterFS volume. Then, mount the volume, and check if that the mount was successful. We hope this GlusterFS and NFS instructions helped you set up your GlusterFS file system through NFS client.