Exporting a GlusterFS volume as a Samba share exposes distributed storage to SMB/CIFS clients such as Windows systems. A single SMB share endpoint can front a replicated or distributed volume, keeping storage management on the GlusterFS side while providing a familiar file-share interface.
Samba exports files from a local directory path defined in /etc/samba/smb.conf, so the GlusterFS volume must be mounted on the host running smbd. The common approach is a GlusterFS client mount via FUSE to a stable mount point, which is then published as an SMB share name.
FUSE mounts often need the allow_other option (plus /etc/fuse.conf configured) so Samba worker processes can access the mount with per-user credentials. Independent Samba servers exporting the same volume can break locking semantics unless Samba clustering (for example CTDB) is used; prefer a single gateway host for a simple deployment. Firewall access to TCP port 445 is required for clients to connect. Authenticated shares reduce the risk of anonymous writes.
Steps to export GlusterFS volume as Samba share:
- Install the Samba server, smbclient, the GlusterFS client packages.
$ sudo apt update && sudo apt install --assume-yes samba smbclient glusterfs-client ##### snipped ##### Setting up samba ... ##### snipped #####
Examples use Ubuntu or Debian package names.
- Enable the user_allow_other setting in /etc/fuse.conf.
$ sudo sed -i 's/^#user_allow_other/user_allow_other/' /etc/fuse.conf $ grep -n '^user_allow_other$' /etc/fuse.conf 15:user_allow_other
- Create a mount point for the volume.
$ sudo mkdir -p /srv/gluster/volume1
- Mount the GlusterFS volume using the allow_other option.
$ sudo mount -t glusterfs -o allow_other node1:/volume1 /srv/gluster/volume1
The node1:/volume1 value is a placeholder for a reachable GlusterFS server plus an existing volume name.
- Confirm the mount is active at /srv/gluster/volume1.
$ findmnt -T /srv/gluster/volume1 TARGET SOURCE FSTYPE OPTIONS /srv/gluster/volume1 node1:/volume1 fuse.glusterfs rw,relatime,allow_other
- Create a dedicated Unix group for SMB access.
$ sudo groupadd --system gluster-smb $ getent group gluster-smb gluster-smb:x:999:
- Create a local Unix account for share authentication.
$ sudo adduser --disabled-password --ingroup gluster-smb --gecos "" smbshare Adding user `smbshare' ... Adding new user `smbshare' (1001) with group `gluster-smb' ... ##### snipped #####
- Set the mount root group ownership to gluster-smb.
$ sudo chgrp gluster-smb /srv/gluster/volume1
- Set group-write permissions with the setgid bit on the mount root.
$ sudo chmod 2770 /srv/gluster/volume1
The leading 2 in 2770 preserves group ownership for new files created under the directory.
- Add the Unix account to the Samba password database.
$ sudo smbpasswd -a smbshare New SMB password: Retype new SMB password: Added user smbshare.
- Create a backup copy of /etc/samba/smb.conf before editing.
$ sudo cp --archive /etc/samba/smb.conf /etc/samba/smb.conf.bak
- Append a share definition to /etc/samba/smb.conf.
$ sudo nano /etc/samba/smb.conf [volume1] comment = GlusterFS volume1 path = /srv/gluster/volume1 browseable = yes read only = no guest ok = no valid users = @gluster-smb force group = gluster-smb create mask = 0660 directory mask = 2770
Setting guest ok = yes on a writable share permits anonymous write access for any client that can reach the SMB ports, effectively turning the share into a public drop box.
- Check the Samba configuration syntax with testparm.
$ sudo testparm --suppress-prompt Load smb config files from /etc/samba/smb.conf Loaded services file OK. Server role: ROLE_STANDALONE
No error output indicates the configuration parses successfully.
- Restart the smbd service.
$ sudo systemctl restart smbd
Restarting smbd disconnects active SMB sessions.
- Check the smbd service status for an active state.
$ sudo systemctl status smbd --no-pager ● smbd.service - Samba SMB Daemon Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2025-12-25 10:15:01 UTC; 4s ago ##### snipped ##### - Allow inbound SMB connections in UFW.
$ sudo ufw allow Samba Rules updated Rules updated (v6)
Systems using firewalld typically open the samba service profile instead of UFW rules.
- List the exported shares using smbclient.
$ smbclient -L //localhost -U smbshare Enter SMB password: Sharename Type Comment --------- ---- ------- volume1 Disk GlusterFS volume1 IPC$ IPC IPC Service (Samba Server) - Open the share in smbclient to list its contents.
$ smbclient //localhost/volume1 -U smbshare -c 'ls' Enter SMB password: . D 0 Thu Dec 25 10:18:44 2025 .. D 0 Thu Dec 25 10:18:44 2025
Windows clients can connect using \\files.example.net\volume1 with a user that belongs to the gluster-smb group.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
