Home NAS with OpenSolaris


After a few requests, I’ve decided to put together a simple howto for building a home NAS with Opensolaris.

The main reasons to choose Opensolaris are simple:

  • Common PC hardware is all you need. No propriatary disk bay system.
  • Gigabit Ethernet. Well, providing your network card and switch support it.
  • Cheap, redundant disk arrays with ZFS, the Opensolaris RAID-like filesystem.
  • Quick and easy setup.

In a nutshell; it’s cheap, it’s easy, and it’s simple. So on the upside you won’t need to spend a great deal of cash to get yourself a nice NAS, but you might miss out on a feature or two.

So let’s get started. I’ll be building my Opensolaris server in VMWare, as it means I don’t have to go breaking any of my physical servers while I’m writing this howto. First thing I’ll do is set up some hardware which will hold the basic system. I’ll go with a single processor, 1Gb of RAM, and a single 8Gb hard disk for the operating system. Normally we’d have more, but for the purposes of this demonstration it’ll do.

Next, I’ll add the Opensolaris ISO as the CD image, and fire it up. Enter your keyboard and language settings as required and the next thing you’ll see is the Solaris desktop.


You’ll notice that it looks a heck of a lot like Ubuntu, Fedora and countless other Linux distributions, mainly because of the fact that it uses Gnome as its desktop environment the same as they do. But under the hood, things are a completely different kettle of fish. We’ll get to that shortly.

Next, double click the ‘Install OpenSolaris’ icon to get started. Hit next on the welcome screen (unless you really want to read the release notes):


Disk settings. I’m going to select to use the entire disk, as I don’t really want to mess about with partitioning disks just yet. On my production server, I installed to a single disk, then mirrored that disk to a second of the same size to provide some redundancy.


Choose your Timezone.


Choose your Language.


Enter a root password and create an account for yourself. You can also set a hostname for your computer, but I’m going to be unimaginative and leave it as opensolaris.


Confirm your settings, then press install to get started.


And we’re away!


After about ten minutes, your installation will finish and your computer will ask you to reboot into its new environment. Log in with the details you entered before and you’ll drop in to your new desktop.

Fire up a terminal (it’s the black icon in the top bar) and we can start doing some poking around. Before we do, though, we need to become an administrator. Enter the pfexec su – to become root.

astro@opensolaris:~$ pfexec su -
Sun Microsystems Inc.   SunOS 5.11      snv_111b        November 2008

Let’s look at what our disks are doing. Solaris gives you two very powerful tools to control your disk arrays: zpool and zfs. Zpool is for controlling a pool of disks, and zfs is for controlling the filesystems which live on your zpool.

So to check our current array, we’ll execute zpool list:

root@opensolaris:~# zpool list
rpool  7.94G  3.21G  4.73G    40%  ONLINE  -

Excellent. We’ve got a pool named ‘rpool’ which is just under 8Gb in size, and is healthy. Which disks are there?

root@opensolaris:~# zpool status rpool
 pool: rpool
 state: ONLINE
 scrub: none requested

 rpool       ONLINE       0     0     0
 c8t0d0s0  ONLINE       0     0     0

errors: No known data errors

Well, only one disk. Not too good for a NAS server, is it? Let’s shut down our machine and add some more disks to play with.


I’m going to add four 10Gb virtual disks to my server, but if you were building a real machine you’d be opening up your server and plugging in your shiny new disks. Either way, when we reboot there’ll be a bunch of new storage media for us to play with. Once you’re done installing, fire up your server once again.

Once you’re back in, open up a terminal and become root again by typing pfexec su -, then type format to show your new disks.

root@opensolaris:~# format
Searching for disks...done

 0. c8t0d0 
 1. c8t1d0 
 2. c8t2d0 
 3. c8t3d0 
 4. c8t4d0 
Specify disk (enter its number):

Use control C to exit this section, as we don’t want to run the risk of damaging c8t0d0 – our system disk, which we know from the zpool status we did earlier. The new disks we just added are listed from c8t1d0 through to c8t4d0.

Ok, so we don’t want to add these new disks to our existing system pool. We want to create an entirely new pool just for our NAS. So let’s do that, and add the new disks we’ve just added.

root@opensolaris:~# zpool create -f naspool raidz c8t1d0 c8t2d0 c8t3d0 c8t4d0

By executing that command, we’ve said that we want to create a new pool of disks called ‘naspool’ which is in RAIDZ1 format. You could use RAIDZ2 if you wanted dual disk redundancy (up to 2 disks can fail before you need to start worrying), but for me, having single disk redundancy is fine.

Let’s see what that pool looks like now:

root@opensolaris:~# zpool status naspool
 pool: naspool
 state: ONLINE
 scrub: none requested

 naspool     ONLINE       0     0     0
 raidz1    ONLINE       0     0     0
 c8t1d0  ONLINE       0     0     0
 c8t2d0  ONLINE       0     0     0
 c8t3d0  ONLINE       0     0     0
 c8t4d0  ONLINE       0     0     0

errors: No known data errors

Excellent. All online and ready to go. But so far we’ve only created the disk pool. Now let’s build some filesystems on top of it. Because I like keeping things in their own little realms, I’m going to create three shares:

 root@opensolaris:~# zfs create -o casesensitivity=mixed mediapool/music
 root@opensolaris:~# zfs create -o casesensitivity=mixed mediapool/photos
 root@opensolaris:~# zfs create -o casesensitivity=mixed mediapool/movies

Excellent. Three folders should be enough for now. What does that look like?

root@opensolaris:~# zfs list
NAME                      USED  AVAIL  REFER  MOUNTPOINT
naspool                   254K  29.3G  32.9K  /naspool
naspool/movies           31.4K  29.3G  31.4K  /naspool/movies
naspool/music            28.4K  29.3G  28.4K  /naspool/music
naspool/photos           28.4K  29.3G  28.4K  /naspool/photos

Fantastic. We’ve now got about 30Gb of striped and paritied data to play with. On my production server it’s more like 3Tb, but that’s a story for another day.

Ok, so we’ve got the storage, but now we need to be able to access it. Let’s turn on filesharing for the NAS. Fire up your package manager, then search for smb and install the following packages:


Reboot to make the changes take effect, then log back in and become root again. Enable the smb server by performing the following command:

root@opensolaris:~# svcadm enable -r smb/server
svcadm: svc:/milestone/network depends on svc:/network/physical, which has multiple instances.

Ignore the output, as it’s merely diagnostic. Now let’s join a workgroup:

root@opensolaris:~# smbadm join -w WORKGROUP
After joining WORKGROUP the smb service will be restarted automatically.
Would you like to continue? [no]: yes
Successfully joined WORKGROUP

Replace WORKGROUP with whatever you’ve got your home network named as. Next, we’ll set up the authentication system:

root@opensolaris:~# echo "other password required pam_smb_passwd.so.1 nowarn" >> /etc/pam.conf

And turn on SMB sharing on our NAS shares and give them some names which mean something:

root@opensolaris:~# zfs set sharesmb=name=Movies naspool/movies
root@opensolaris:~# zfs set sharesmb=name=Photos naspool/photos
root@opensolaris:~# zfs set sharesmb=name=Music naspool/music

Then make sure that your account has access to read and write as it pleases:

root@opensolaris:~# chown -R astro /naspool

Finally, update your password.

root@opensolaris:~# passwd astro
New Password: <password>
Re-enter new Password: <password>
passwd: password successfully changed for astro

Excellent. Our shares are all set up and ready to go. Let’s add them to Windows. Open up an explorer window and type \\opensolaris, or whatever your computer name was. You can also use the IP address if you want to.

When the authentication window pops up, enter your account details and you should be greeted with the following wonderous sight:


And you should be able to copy all your files over with ease.


So what’s next? Well, next week we’ll look at how you can expand your Opensolaris NAS with more or bigger disks to make a truly inexhaustable supply of storage awesome.

See you next time!


One thought on “Home NAS with OpenSolaris

  1. Pingback: Home NAS Expansion – Continued « irrationale

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s