Exporting a GlusterFS volume as a Samba share enables systems using the SMB/CIFS protocol, such as Windows clients, to access the distributed storage. This method allows you to take advantage of GlusterFS's scalability and redundancy while providing compatibility with Samba-based file sharing.

To export a GlusterFS volume via Samba, first mount the volume locally on the machine where Samba is running. The mounted volume can then be shared via the Samba service using the appropriate configuration in the Samba configuration file. This setup allows the distributed GlusterFS storage to be accessed over the network using the SMB/CIFS protocol.

Make sure that the necessary firewall rules are in place to allow Samba traffic. The client machines can then access the shared volume using standard SMB clients, providing cross-platform compatibility with your GlusterFS storage.

Steps to export GlusterFS volume as Samba share:

  1. Install the Samba service on all GlusterFS nodes.
    $ sudo apt install samba # Ubuntu/Debian
    $ sudo yum install samba # CentOS/Fedora/Red Hat
  2. Mount the GlusterFS volume on the local machine.
    $ sudo mount -t glusterfs node1:/volume1 /mnt/glusterfs
  3. Set the appropriate permissions for the mounted GlusterFS directory.
    $ sudo chown -R nobody:nogroup /mnt/glusterfs
    $ sudo chmod -R 0775 /mnt/glusterfs
  4. Add the mounted GlusterFS volume to the Samba configuration.
    $ sudo nano /etc/samba/smb.conf
    
      [gluster_volume]
      comment = GlusterFS Volume
      path = /mnt/glusterfs
      browseable = yes
      read only = no
      guest ok = yes
  5. Restart the Samba service to apply the changes.
    $ sudo systemctl restart smbd
    $ sudo systemctl enable smbd
  6. Allow Samba traffic through the firewall.
    $ sudo firewall-cmd --zone=public --add-service=samba --permanent && sudo firewall-cmd --reload # CentOS, Fedora, Red Hat
    $ sudo ufw allow samba # Ubuntu and Debian
  7. Verify the share from a client machine using the SMB/CIFS protocol.
    $ smbclient -L //server_ip/gluster_volume -U guest
Discuss the article:

Comment anonymously. Login not required.