Sun Java Solaris Communities My SDN Account Join SDN
 
Article

Developer Recipes: Setting Up an OpenSolaris NAS Box

 
May 2008  

With the new CIFS server in the OpenSolaris OS, it's a great time to use ZFS and CIFS to create a home NAS box to replace a Windows share machine.

Contents


Step 1: Get the Hardware


To get started, you need hardware for the NAS box. This example uses the following hardware:

  • A multipack (six 40GB drives)
  • A retired W2100Z workstation. (This is a great platform with dual 64-bit AMD processors, an internal SCSI drive, and a place to put 3 more drives.)
  • Some DIMMs for the W2100Z
  • An extra SCSI card

Step 2: Assemble the Hardware


Before you begin the hardware upgrade, attach an antistatic strap to your wrist.

Next, attach the SCSI card to the multipack. The extra memory is used to help ZFS work better. When you've assembled the hardware, it's time to install the OpenSolaris OS.


Step 3: Install OpenSolaris SXDE 1/08


Preparing to install the OpenSolaris OS is quite simple and quick (takes 5 minutes or so):

  1. Download and burn the DVD.
  2. Insert the DVD.
  3. Boot the workstation.
  4. Answer the questions.
  5. Click the Finish button.

Then the actual installation begins. In this example the installation takes about 1.5 hours, and then the new server is up and running the OpenSolaris OS.

Next, you need to configure everything.


Step 4: Configure the OpenSolaris OS


Start by accessing the CIFS Getting Started Guide. This guide is invaluable and provides everything you need to get started.

Create the Users

To begin, create a few different users. At installation time, create a root user account and after this, create a "privileged" regular user and a user that can own the files. Use the user IDs admin and media for these purposes. To add the users, use the Users and Groups action on the Administration section of the Start Menu.

Figure 1: Creating Users

Figure 1: Creating Users


Create a Storage Pool

To get the server up and serving data, you need to configure the storage. To do this, use the ZFS GUI by pointing a browser to https://<hostname>:6789/zfs and logging in as a user with root permissions. This GUI provides the ability to see all the storage attached to your system and how it is being used. Select all the drives on the multipack and create a single RAIDZ1 pool named mediapool.

Figure 2: Creating a Storage Pool

Figure 2: Creating a Storage Pool


After creating a ZFS pool with the ZFS GUI, switch to a terminal window to check the status of the newly created pool:

 # zfs list
 NAME        USED  AVAIL  REFER  MOUNTPOINT
 mediapool   144K   165G  29.9K  /mediapool

Create the File Systems

Next, create the file systems:

 # zfs create -o casesensitivity=mixed mediapool/music
 # zfs create -o casesensitivity=mixed mediapool/photos
 # zfs create -o casesensitivity=mixed mediapool/movies

To use mixed case for the file names, set the ZFS property to casesensitivity=mixed. This is a very important step when sharing files with Windows systems. If you don't do this, all of the file names will get set to all uppercase, which is very hard to read.

Configure CIFS

After creating the file systems, start the CIFS service:

 # svcadm enable -r smb/server
 # smbadm join -w WORKGROUP

You can use the workgroup mode for sharing the files. In most cases, you keep the workgroup set to WORKGROUP.

Set Up Authentication

You also need to update the OpenSolaris password system to configure the CIFS server to use PAM (pluggable authentication module) authentication. Do this using the following command:

 # echo "other password required pam_smb_passwd.so.1 nowarn" >> /etc/pam.conf

Additionally, after entering the preceding command, you must reset the passwords for all users who will use the CIFS authentication:

 # passwd media

Now you are ready to start sharing the file systems you created.

Share File Systems

You're getting closer to being able to use the new server. CIFS is enabled, the file systems are created, and you just need to get them shared:

 # zfs set sharesmb=name=Movies mediapool/movies
 # zfs set sharesmb=name=Music mediapool/music
 # zfs set sharesmb=name=photos mediapool/photos
Figure 3: Sharing File Systems

Figure 3: Sharing File Systems


You could have used a single set command with the sharesmb=on option, but use the commands shown here if you want useful names on the Windows machines. To avoid any ambiguous or long share names, you explicitly set them. This is one of the little tricks and helpful tips found in the CIFS Getting Started Guide and the discussion forums.

Set File System Permissions

For your last step, all of the files need to be owned by your primary share user:

 # chown -R media /mediapool

After this last step, you are done configuring the OpenSolaris OS on your NAS box.


Step 5: Configuring Windows


Now, the real fun begins. So far in this example setup, it took only 2 hours to assemble the server hardware, install the OS, and configure the storage, and 90 minutes of that was the OpenSolaris installation.

While using a Windows XP system for email and web browsing is pretty simple, there is some complexity in sharing files. Sharing files with CIFS is different than sharing file with NFS.

When mounting a CIFS share from an OpenSolaris system, you must authenticate to that server. This point is critical. The authentication also has to be from the perspective of the server and not the client.

To make the share on the windows client work, do the following:

  1. Map a Windows drive with the Folder path of \\<OpenSolaris_Server>\<sharename>.
  2. Select the "Connect using a different user name" link and use the user name and password from the OpenSolaris server.
Figure 4: Mapping a Network Drive

Figure 4: Mapping a Network Drive


For the example machine, the Folder path is \\PHRED\Movies and the user name is media.

This provides a way for all of your Windows machines to access a shared file system on your new OpenSolaris NAS box.


For More Information


Here is a list of web sites, blogs, and discussion lists: