GlusterFS : GlusterFS + SMB2026/04/28 |
|
Configure GlusterFS volume to enable SMB protocol. For example, Configure SMB setting to a Gluster Volume [vol_distributed] like an example of the link here. |
|
| [1] | Configure GlusterFS to enable SMB setting on a Node in GlusterFS Cluster. |
|
root@node01:~#
apt -y install samba samba-vfs-modules-extra ctdb
# stop the target Gluster volume and change settings root@node01:~# gluster volume stop vol_distributed Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y volume stop: vol_distributed: success root@node01:~# gluster volume set vol_distributed user.smb enable volume set: success root@node01:~# gluster volume set vol_distributed performance.write-behind off volume set: success
root@node01:~#
gluster volume set vol_distributed group samba volume set: success
root@node01:~#
vi /var/lib/glusterd/hooks/1/start/post/S29CTDBsetup.sh # line 25 : change to the target Gluster volume name META=" vol_distributed "
root@node01:~#
vi /var/lib/glusterd/hooks/1/stop/pre/S29CTDB-teardown.sh # line 13 : change to the target Gluster volume name META=" vol_distributed "
# start Gluster volume root@node01:~# gluster volume start vol_distributed volume start: vol_distributed: success # with the settings above, following mounting is done automatically root@node01:~# df -h /gluster/lock Filesystem Size Used Avail Use% Mounted on node01.srv.world:/vol_distributed.tcp 28G 12G 15G 45% /gluster/lockroot@node01:~# tail -1 /etc/fstab node01.srv.world:/vol_distributed /gluster/lock glusterfs _netdev,transport=tcp,xlator-option=*client*.ping-timeout=10 0 0
root@node01:~#
vi /etc/ctdb/nodes # create new # write all Nodes that configure target Gluster volume 10.0.0.51 10.0.0.52
root@node01:~#
vi /etc/ctdb/public_addresses # create new # set virtual IP address for SMB access # [enp1s0] means network interface name ⇒ replace to your environment 10.0.0.59/24 enp1s0
root@node01:~#
systemctl enable --now ctdb
# confirm status root@node01:~# ctdb status Number of nodes:2 pnn:0 10.0.0.51 OK (THIS NODE) pnn:1 10.0.0.52 DISCONNECTED|UNHEALTHY|INACTIVE Generation:1627106406 Size:1 hash:0 lmaster:0 Recovery mode:NORMAL (0) Leader:0root@node01:~# ctdb ip Public IPs on node 0 10.0.0.59 0 |
| [2] | Configure Samba. For example, Create a shared Folder that users in [smbgroup] group can only access to shared folder [smbshare] and also they are required user authentication. |
|
# mount Gluster volume with GlusterFS Native and create a shared folder for SMB access root@node01:~# mount -t glusterfs node01.srv.world:/vol_distributed /mnt root@node01:~# mkdir /mnt/smbshare root@node01:~# groupadd smbgroup root@node01:~# chgrp smbgroup /mnt/smbshare root@node01:~# chmod 770 /mnt/smbshare root@node01:~# umount /mnt
root@node01:~#
vi /etc/samba/smb.conf
[global]
# add into the [global] section
clustering = yes
kernel share modes = no
kernel oplocks = no
map archive = no
map hidden = no
map read only = no
map system = no
store dos attributes = yes
.....
.....
# last line : following 9 lines are configured automatically
[gluster-vol_distributed]
comment = For samba share of volume vol_distributed
vfs objects = glusterfs
glusterfs:volume = vol_distributed
glusterfs:logfile = /var/log/samba/glusterfs-vol_distributed.%M.log
glusterfs:loglevel = 7
path = /
read only = no
kernel share modes = no
# add follows
writable = yes
valid users = @smbgroup
force group = smbgroup
force create mode = 770
force directory mode = 770
inherit permissions = yes
root@node01:~#
systemctl restart smb
# add Samba user root@node01:~# useradd ubuntu root@node01:~# smbpasswd -a ubuntu New SMB password: # set any SMB password Retype new SMB password: Added user debian. root@node01:~# usermod -aG smbgroup ubuntu |
| [3] | If UFW is enabled, allow service ports. |
|
root@node01:~# ufw allow 139/tcp root@node01:~# ufw allow 445/tcp root@node01:~# ufw allow 4379/tcp root@node01:~# ufw allow 4379/udp |
| [4] | Verify it can access to the target share with SMB from any Linux client computer. The examples below are on Linux clients but it's possible to access from Windows clients with common way. |
|
root@client:~#
apt -y install smbclient cifs-utils # verify with [smbclient] root@client:~# smbclient //node01.srv.world/gluster-vol_distributed -U ubuntu Password for [WORKGROUP\ubuntu]: Try "help" to get a list of possible commands. # verify witable to move to shared folder smb: \> cd smbshare smb: \smbshare\> mkdir testdir smb: \smbshare\> ls . D 0 Tue Apr 28 00:47:43 2026 .. D 0 Tue Apr 28 00:37:30 2026 testdir D 0 Tue Apr 28 00:47:43 2026 28678160 blocks of size 1024. 15248912 blocks available smb: \smbshare\> exit # verify with [mount] # for [10.0.0.59], it is virtual IP address set in [1] section root@client:~# mount -t cifs -o vers=3,username=ubuntu //10.0.0.59/gluster-vol_distributed /mnt Password for ubuntu@//10.0.0.59/gluster-vol_distributed: df -hT Filesystem Type Size Used Avail Use% Mounted on tmpfs tmpfs 680M 1.5M 679M 1% /run /dev/mapper/ubuntu--vg-ubuntu--lv ext4 14G 5.7G 7.3G 44% / tmpfs tmpfs 1.7G 0 1.7G 0% /dev/shm none tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service none tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-resolved.service tmpfs tmpfs 1.7G 0 1.7G 0% /tmp /dev/vda2 ext4 2.0G 96M 1.7G 6% /boot none tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-networkd.service none tmpfs 1.0M 0 1.0M 0% /run/credentials/getty@tty1.service none tmpfs 1.0M 0 1.0M 0% /run/credentials/serial-getty@ttyS0.service tmpfs tmpfs 340M 8.0K 340M 1% /run/user/0 //10.0.0.59/gluster-vol_distributed cifs 28G 13G 15G 47% /mntroot@client:~# touch /mnt/smbshare/testfile.txt root@client:~# ll /mnt/smbshare total 12 drwxr-xr-x 2 root root 0 Apr 28 00:49 ./ drwxr-xr-x 2 root root 0 Apr 28 00:37 ../ drwxr-xr-x 2 root root 0 Apr 28 00:47 testdir/ -rwxr-xr-x 1 root root 0 Apr 28 00:49 testfile.txt* |
| Sponsored Link |
|
|