9.3. SMB

You can use SMB (Server Message Block) protocol to access to Red Hat Storage volumes when using Microsoft Windows as well as Linux clients. SMB is also known as CIFS (Common Internet File System). For this access method, SMB Client (CIFS) packages need to be present on the client side. You can export the glusterFS mount point as the Samba export on the server, and then mount it using the SMB protocol on the client.
This section describes how to mount SMB shares on Microsoft Windows-based clients (both manually and automatically) and how to verify that the volume has been mounted successfully.

Note

SMB access using the Mac OS X Finder is not supported. You can, however, use the Mac OS X command line to access Red Hat Storage volumes using SMB.
If you are using Samba with Windows Active Directory, you must install the following packages on the linux client using the following commands:
# yum install samba-winbind 
# yum install samba-client 
# yum install krb5-workstation

9.3.1. Mounting Red Hat Storage Volumes as SMB Shares

You can use either of the following methods to mount Red Hat Storage volumes using SMB:
After mounting a volume, you can test the mounted volume using the procedure described in Section 9.3.1.5, “Testing Volumes Mounted Using SMB on Red Hat Enterprise Linux and Windows”.

9.3.1.1. Exporting Red Hat Storage Volumes Through Samba

You can use Samba to export Red Hat Storage volumes through the SMB protocol.
To export volumes through SMB protocol
  1. Mount a Red Hat Storage volume. For more information on mounting volumes, see Section 9.1.2, “Mounting Red Hat Storage Volumes”.
  2. Setup the Samba configuration to export the mount point of the Red Hat Storage volume.
    For example, if a Red Hat Storage volume is mounted on /mnt/gluster, you must edit the /etc/samba/smb.conf file to enable sharing of Red Hat Storage volumes over SMB. Open the /etc/samba/smb.conf file in a text editor and add the following lines for a simple configuration:
    [glustertest]
    comment = For testing a Red Hat Storage volume exported over SMB
    path = /mnt/gluster
    read only = no
    guest ok = yes
    Save the changes and start or restart the SMB (Server Message Block) service using your system's init scripts (/etc/init.d/smb [re]start).
  3. Set the SMB password using the following command:
    # smbpasswd -a username
    You will be prompted for a password, provide the SMB password. This password will be used during the SMB mount.

Note

To be able mount from any server in the trusted storage pool, you must repeat these steps on each Red Hat Storage node. For more advanced configurations, refer to the Samba documentation.

9.3.1.2. Automatically Exporting Red Hat Storage Volumes Through Samba

When you start a volume using gluster volume start VOLNAME command, the volume is automatically exported through Samba on all Red Hat Storage servers running Samba. The Red Hat Storage volume is mounted using the Red Hat Storage Native Client at /mnt/samba/VOLNAME. It is exported as a Samba share named as gluster-VOLNAME.
To disable automatic mounting of volumes through Samba, rename the S30samba-start.sh located at /var/lib/glusterd/hooks/1/start/post to K30samba-start.sh.
For more information on the above scripts, see Section 14.2, “Prepackaged Scripts”.

9.3.1.3. Manually Mounting Volumes Using SMB on Red Hat Enterprise Linux and Windows

You can manually mount Red Hat Storage volumes using SMB on Red Hat Enterprise Linux and Microsoft Windows-based client machines.
To manually mount a Red Hat Storage volume using SMB on Red Hat Enterprise Linux
  • Mount the Samba exported SMB share using the following command:
    # mount -t cifs Samba_Server_IP_Address:/Share_Name Mount_Point
    For example, if a Red Hat Storage volume is exported through SMB using the /etc/samba/smb.conf file with the following entry:
    [glustertest]
    comment = For testing a Red Hat Storage volume exported over SMB
    path = /mnt/gluster
    read only = no
    guest ok = yes
    Perform the SMB mount of the Red Hat Storage volume using the following command:
    # mount -t cifs 192.168.1.60:/glustertest /mnt/smb
To manually mount a Red Hat Storage volume using SMB on Windows
  1. Using Windows Explorer, choose Tools > Map Network Drive… from the menu. The Map Network Drive window appears.
  2. Choose the drive letter using the Drive drop-down list.
  3. In the Folder text box, enter the path of the server and the shared resource in the following format: \\SERVER_NAME\VOLNAME.
  4. Click Finish.
The network drive (mapped to the volume) appears in the Computer window.
Alternatively, to manually mount a Red Hat Storage volume using SMB
  1. Click Start, and then click Run.
  2. In the Open box, enter cmd.
  3. Enter net use z: \\SERVER_NAME\VOLNAME, where z: is the drive letter you want to assign to the shared volume.
    For example, net use y: \\server1\test-volume

9.3.1.4. Automatically Mounting Volumes Using SMB on Red Hat Enterprise Linux and Windows

You can configure your system to automatically mount Red Hat Storage volumes using SMB on Microsoft Windows-based clients each time the system starts.
To automatically mount a Red Hat Storage volume using SMB on Red Hat Enterprise Linux
  • To automatically mount a volume, edit the /etc/fstab file and add the following line:
    hostname-or-IPaddress:/Share_Name mountdir smb credentials=filename,_netdev 0 0
    For example,
    server1:/glustertest /mnt/glusterfs smb credentials=/etc/samba/passwd,_netdev 0 0
    You must specify the filename and its path that contains username and/or password in the credentials option in /etc/fstab file. Refer to the mount.cifs man page for more information.
To automatically mount a Red Hat Storage volume using SMB on Windows
The network drive (mapped to the volume) appears in the Computer window and is reconnected each time the system starts.
  1. Using Windows Explorer, choose Tools > Map Network Drive… from the menu. The Map Network Drive window appears.
  2. Choose the drive letter using the Drive drop-down list.
  3. In the Folder text box, enter the path of the server and the shared resource in the following format: \\SERVER_NAME\VOLNAME.
  4. Click the Reconnect at logon checkbox.
  5. Click Finish.

9.3.1.5. Testing Volumes Mounted Using SMB on Red Hat Enterprise Linux and Windows

You can confirm that Red Hat Storage directories are mounting successfully.
To test mounted volumes on Red Hat Enterprise Linux
  • Use the smsbtatus command by entering the following:
    # smbstatus -S
    For example, the output of the status command on the client will display an entry similar to the following:
    Service        pid     machine             Connected at
    -------------------------------------------------------------------
    glustertest   11967   __ffff_192.168.1.60  Mon Aug  6 02:23:25 2012
To test mounted volumes on Windows
  • You can confirm that Red Hat Storage directories are mounting successfully by navigating to the directory using Windows Explorer.