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.

Steps to mount GlusterFS volume in Linux:

  1. Launch terminal session on the GlusterFS server.
  2. List available GlusterFS volumes on the server.
    $ sudo gluster volume list
    [sudo] password for user:
    volume1 
  3. 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
  4. Launch terminal session on the client.
  5. Open the /etc/hosts file using your preferred text editor.
  6. Add the static host entries.
    192.168.111.70    node1.gluster.local    node1
    192.168.111.71    node2.gluster.local    node2
  7. 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
  8. Create a mount point directory on the client.
    $ sudo mkdir -p /mnt/volume1
  9. Mount the GlusterFS volume manually using the server hostname.
    $ sudo mount -t glusterfs node1:/volume1 /mnt/volume1/
  10. 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
  11. Unmount the GlusterFS volume if needed.
    $ sudo umount /mnt/volume1
  12. Open the /etc/fstab file using your preferred text editor.
    $ sudo vi /etc/fstab
  13. Add an entry for the GlusterFS volume.
    node1:/volume1  /mnt/volume1 glusterfs  defaults,_netdev        0 0
  14. Save the changes and exit the editor.
  15. Mount the GlusterFS volume using the /fstab entry.
    $ sudo mount /mnt/volume1/
  16. 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
  17. Reboot the system and verify the volume is mounted automatically.
    $ sudo reboot
Discuss the article:

Comment anonymously. Login not required.