Adventures in OpenSolaris - Building a ZFS pool as a network share

Note: This entry is part of series which starts here

Working with ZFS is actually quite easy. If you have done any work with any other type of RAID, NAS, etc, you will truly understand what an amazing file system ZFS is and how easy it is to work with. The first time I built a ZFS filesystem for a customer, they did not believe me because I had done it so quickly, and made me delete it and do it again. No challenge what so ever with ZFS!

The official docs for ZFS can be found here and a good best practice guide can be found here.

So without further ado lets create the ZFS pool. First I run the format command to see a list of my disks.

Elmerfudd

The disks that I want to use c3d1, c4d0 and c4d1. These are all 500GB disks, that I will put into a raidz1 configuration. raidz1 provides for the ability to have an entire disk fail without data loss. With raidz, your pool will be the size of your disks minus one, so in my case I will wind up with about 1T of space in my pool. (3\*500GB - 500GB).

Now you may have noticed that the server I am working on is named ElmerFudd so what better to name the share than shotgun? The command below creates a zfs file. The -m command defines the mount point, raidz1 defines the raid to use, and the list of disks define what disks should go into the pool:
#zpool create -m /export/shotgun shotgun raidz1 c3d1 c4d0 c4d1

Almost instantaneously the raid is created!

We can check the status of the pool with the following command:
#zpool status shotgun

Elmerfudd2

Note with this command we can see that there are 3 drives configured in raidz1.

Great now we have an almost 1TB raidz file system, ready to store all of backup data on it. The next challenge is that my data is on my Macs and Window machine. How to network share the file system so that the other machines can see it? I choose to use SMB, which is the Solaris implementation of CIF, which I knew both my mac and windows box would be able to see.

I again started with google to find the steps necessary to get an SMB sharing out a ZFS filesystem on OpenSolaris. I came across this blog which has the necessary steps, which I have included here as well. More details about SMB shares can be found at the Sun Docs on the subject.

The smb isn’t included in the default kernel, you can install it with:
# pfexec pkg install SUNWsmbs
# pfexec pkg install SUNWsmbskr

You then need to reboot the system

Next you will need to enable the server to start automatically at system boot
# svcadm enable -r smb/server
If you get an error about more than one interface it is okay

Check to see if the smb service is running:
# svcs | grep smb

Next we need to modify our pool to turn on smb sharing the following command does just that:
#zfs set sharesmb=on shotgun

The following command shows us the status of our zfs pool. Notice the smbshare setting is turned on.
#zfs get all shotgun

Elmerfudd3

Next we need to modify the pam.conf file to allow users to authenticate against the share. SMB keeps a separate password file so you need to run the password command for any user who you want to be able to mount the smb share.

Add this line to /etc/pam.conf:
# Seem to need this line for smb / cifs:
other password required pam_smb_passwd.so.1 nowarn

reset the password:
#passwd <user who wants share access>

Now for the real test. Can I see the share from my Mac and Windows machine? On my mac using finder, I went to the Go Menu and then connect to server. In the connect box I typed smb://elmerfudd/shotgun. I was prompted for my username and password and the share mounted.

From my windows system I went to map network drive and entered \\\\elmerfudd\\shotgun. Again after providing my credentials the share was mounted.

My adventure continues here

Technorati Tags: ,

Comments:

Post a Comment:
Comments are closed for this entry.
About

user12609114

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today