GlusterFS volumes can be mounted on Linux systems either manually or automatically. The manual method uses the mount command, while the automatic method involves editing the /etc/fstab file to ensure the volume mounts at boot. However, before a GlusterFS volume can be mounted, the necessary GlusterFS client software must be installed on the client machine, as it is not typically included by default in most distributions.
Most Linux distributions offer the required GlusterFS packages through their default package manager. These packages include the client libraries needed to communicate with GlusterFS servers. Once installed, the volume can be mounted from the GlusterFS server to the client, allowing seamless access to the distributed storage.
To ensure proper functionality, the client machine must be able to resolve the server's hostname, which can be configured in the /etc/hosts file. After installing the client software, creating the mount point, and mounting the volume, it's important to test whether the volume is accessible. You can configure automatic mounting by adding the appropriate entry in /etc/fstab, ensuring the volume is mounted during system startup.
Related: How to create a GlusterFS volume
Steps to mount GlusterFS volume in Linux:
- Launch terminal session on the GlusterFS server.
- List available GlusterFS volumes on the server.
$ sudo gluster volume list [sudo] password for user: volume1
- List the hostnames of GlusterFS peers on the server.
$ cat /etc/hosts 192.168.111.70 node1.gluster.local node1 192.168.111.71 node2.gluster.local node2
- Launch terminal session on the client.
- Open the /etc/hosts file using your preferred text editor.
- Add the static host entries.
192.168.111.70 node1.gluster.local node1 192.168.111.71 node2.gluster.local node2
- Install the GlusterFS client software.
$ sudo apt update && sudo apt install --assume-yes glusterfs-client # Ubuntu or Debian variant
$ sudo dnf install --assumeyes glusterfs-fuse # CentOS, Fedora or Red Hat variance
- Create a mount point directory on the client.
$ sudo mkdir -p /mnt/volume1
- Mount the GlusterFS volume manually using the server hostname.
$ sudo mount -t glusterfs node1:/volume1 /mnt/volume1/
- Verify the mount is successful by checking the mounted filesystem.
$ df /mnt/volume1/ Filesystem 1K-blocks Used Available Use% Mounted on node1:/volume1 19991152 8207136 10945388 43% /mnt/volume1
- Unmount the GlusterFS volume if needed.
$ sudo umount /mnt/volume1
- Open the /etc/fstab file using your preferred text editor.
$ sudo vi /etc/fstab
- Add an entry for the GlusterFS volume.
node1:/volume1 /mnt/volume1 glusterfs defaults,_netdev 0 0
- Save the changes and exit the editor.
- Mount the GlusterFS volume using the /fstab entry.
$ sudo mount /mnt/volume1/
- Test if GlusterFS volume is successfully mounted.
$ df /mnt/volume1/ Filesystem 1K-blocks Used Available Use% Mounted on node1:/volume1 19991152 8207136 10945388 43% /mnt/volume1
- Reboot the system and verify the volume is mounted automatically.
$ sudo reboot
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.