Part 7 of a series that describes the key features of ZFS in Oracle Solaris 11.1 and provides step-by-step procedures explaining how to use them. This article focuses on sharing ZFS file systems using the SMB protocol. The first 6 parts were published in the old OTN web page.
Published December 2014
- Part 1 - Using COMSTAR and ZFS to Configure a Virtualized Storage Environment (on old OTN web)
- Part 2 - Playing with Swap Monitoring and Increasing Swap Space Using ZFS Volumes (on old OTN web)
- Part 3 - Playing with ZFS Shadow Migration (on old OTN web)
- Part 4 - Delegating a ZFS Dataset to a Non-Global Zone (on old OTN web)
- Part 5 - Playing with ZFS Encryption (on old OTN web)
- Part 6 - Playing with ZFS Snapshots (on old OTN web)
- Part 7 - Configuring SMB Sharing
- Part 8 - Mirroring the ZFS Root Pool
Oracle Solaris 11 allows us to share a ZFS file system using the Server Message Block (SMB) protocol that was originally created by Microsoft. The procedure for sharing files using SMB is similar to sharing files using NFS and, honestly, it's so easy.
Here the fun begins.
First, we must install the SMB service on the system, if necessary. This service is installed when you install Oracle Solaris 11.1.
root@solaris11-1:~# pkg install service/file-system/smb
Next, create a file system with the
share.smb, the SMB protocol mandatory locking (
nbmand), and the cache client (
csc) properties enabled:
root@solaris11-1:~# zfs create -o share.smb=on -o nbmand=on -o share.smb.csc=auto rpool/smb_example_1
The second file system will be created with almost the same configuration, but we will also accept guest clients by including the
root@solaris11-1:~# zfs create -o share.smb=on -o nbmand=on -o share.smb.csc=auto \
Then, check whether the
sharesmb property is configured:
root@solaris11-1:~# zfs get sharesmb rpool/smb_example_1
It's likely that the SMB server is not configured. Thus, this task must be done:
root@solaris11-1:~# svcadm enable -r smb/server
After the SMB shares are configured, we can verify that the shares are offered by our system:
root@solaris11-1:~# zfs get share
There's an interesting way to learn about the ACL information for a share such as
root@solaris11-1:/ cd /rpool/smb_example_1/.zfs/shares
Now, we will create a new user (with a password) and enable the new user to use the SMB share service:
root@solaris11-1:~# useradd borges
SMB authentication can be enabled by inserting a new line at the end of the
/etc/pam.d/other configuration file:
password required pam_smb_passwd.so.1 nowarn root@solaris11-1:~# more /etc/pam.d/other
Done. Now, confirm that everything is working. On the second machine (
solaris11-2), look up the first machine:
root@solaris11-2:/mnt# smbadm lookup-server //solaris11-1
And then we can verify which shares are available:
root@solaris11-2:/mnt# smbadm show-shares -u borges solaris11-1
Mount the first ZFS share (
smb_example_1) from machine
solaris11-1 onto machine
root@solaris11-2:~# mount -o user=borges -F smbfs //solaris11-1/smb_example_1 /mnt
Now, instead of mounting the second SMB share (
solaris11-2 using the Oracle Solaris 11.1 command line, let's accomplish this task using Microsoft Windows.
For example, if you are running Microsoft Windows 7, you can search for ZFS shares by clicking the Windows Start icon and typing
\\192.168.1.103 into the search box, as shown in Figure 1:
Figure 1. Searching for ZFS shares
As soon as you press Enter, all shares provided by machine
solaris11-1 are shown. See Figure 2.
Figure 2. Currently available ZFS shares
smb_example_2 folder to see the content of the
Figure 3. Content of
smb_example_2 ZFS share
It worked! And, in case you didn't notice, no password was required because of the
guestok=true setting that we configured for this second SMB share. If we had used the same procedure we used with the first SMB share (
smb_example_1), we would have been asked for the username (
Workgroup\borges) and the user's password.
Finally, unsharing is done by executing the following:
root@solaris11-1:~# zfs share.smb=off rpool/smb_example_1
Here are some links to other things I've written:
- Alexandre Borges on Twitter
- Alexandre Borges' personal blog
- "Exploring Installation Options and User Roles in Oracle Solaris 11"
- "Exploring Networking, Services, and the New Image Packaging System in Oracle Solaris 11"
- Oracle Solaris 11 Advanced Administration Cookbook
And here are some Oracle Solaris 11 resources:
- Download Oracle Solaris 11
- Access Oracle Solaris 11 product documentation
- Access all Oracle Solaris 11 how-to articles
- Learn more with Oracle Solaris 11 training and support
- See the official Oracle Solaris blog
- Check out The Observatory and OTN Garage blogs for Oracle Solaris tips and tricks
- Follow Oracle Solaris on Facebook and Twitter
About the Author
Alexandre Borges is an Oracle ACE in Solaris and has been teaching courses on Oracle Solaris since 2001. He worked as an employee and a contracted instructor at Sun Microsystems, Inc. until 2010, teaching hundreds of courses on Oracle Solaris (such as Administration, Networking, DTrace, and ZFS), Oracle Solaris Performance Analysis, Oracle Solaris Security, Oracle Cluster Server, Oracle/Sun hardware, Java Enterprise System, MySQL Administration, MySQL Developer, MySQL Cluster, and MySQL tuning. He was awarded the title of Instructor of the Year twice for his performance teaching Sun Microsystems courses. Since 2009, he has been imparting training at Symantec Corporation (NetBackup, Symantec Cluster Server, Storage Foundation, and Backup Exec) and EC-Council [Certified Ethical Hacking (CEH)]. In addition, he has been working as a freelance instructor for Oracle education partners since 2010. In 2014, he became an instructor for Hitachi Data Systems (HDS) and Brocade.
Currently, he also teaches courses on Reverse Engineering, Windows Debugging, Memory Forensic Analysis, Assembly, Digital Forensic Analysis, and Malware Analysis. Alexandre is also an (ISC)2 CISSP instructor and has been writing articles on the Oracle Technical Network (OTN) on a regular basis since 2013.
|Revision 1.1, 12/16/2014|