4.2 Accessing Volumes using NFS

You can expose volumes using NFS-Ganesha. NFS-Ganesha is a user space file server for the NFS protocol. It provides a FUSE-compatible File System Abstraction Layer (FSAL) to allow access from any NFS client.

To access a volume using NFS:

On each node in the trusted storage pool on which you want to enable NFS access:

  1. Install the Gluster NFS-Ganesha client packages:

    # yum install nfs-ganesha-gluster
  2. Create an export configuration file in the /etc/ganesha/exports directory. This file contains the NFS export information for NFS Ganesha. In this example we use the file name export.myvolume.conf to export a volume named myvolume to an NFS share located at /myvolume on the node.

        Export_Id = 1 ;   # Export ID unique to each export
        Path = "/myvolume";  # Path of the volume to be exported. Eg: "/test_volume"
        FSAL {
            name = GLUSTER;
            hostname = "localhost";  # IP of one of the nodes in the trusted pool
            volume = "myvolume";  # Volume name. Eg: "test_volume"
        Access_type = RW;    # Access permissions
        Squash = No_root_squash; # To enable/disable root squashing
        Disable_ACL = TRUE;  # To enable/disable ACL
        Pseudo = "/myvolume";  # NFSv4 pseudo path for this export. Eg: "/test_volume_pseudo"
        Protocols = "3","4" ;    # NFS protocols supported
        Transports = "UDP","TCP" ; # Transport protocols supported
        SecType = "sys";     # Security flavors supported

    Edit the /etc/ganesha/ganesha.conf file to include the new export configuration file, for example:

    %include "/etc/ganesha/exports/export.myvolume.conf"
  3. Enable and start the nfs-ganesha service:

    # systemctl enable --now nfs-ganesha

    If the volume is created after you set up access using NFS, you must reload the nfs-ganesha service:

    # systemctl reload-or-restart nfs-ganesha
  4. Check the volume is exported:

    # showmount -e localhost
    Export list for localhost:
    /myvolume (everyone)
  5. To connect to the volume from an NFS client, mount the NFS share, for example:

    # mkdir /gluster-storage
    # mount node1:/myvolume /gluster-storage

    Any files created in this /gluster-storage directory on the NFS client are written to the volume.