Seven Useful OpenSolaris ZFS Home Server Tips
A lot of people have read last year's article "A Small and Energy-Efficient OpenSolaris Home Server" (Thanks a lot to Andre Lue from the EON project for linking to it!) and there was quite some discussion on different RAID options as a result of my RAID-Greed article.
So let's continue the theme and have a look at the following home server tips that helped me a lot during my own home server planning, building and installing:
#1: Figure Out Your Home Server Goals, Constraints and Priorities
It's always good to know what you want to do with your home server, be aware of your constraints and then prioritize your specific requirements. This may sound trivial, but this it exactly what is often overlooked in the frenzy of studying features, data sheets, pricing etc.
This is also a very personal thing: Everybody follows different goals, has different constraints and decides on different priorities. The following lists should therefore serve as sources of inspiration:
Potential Home Server Goals
- A backup file server for your laptop or other systems.
- An infrastructure server for routing, (Dyn)DNS, DHCP, Email, etc.
- A development/testing machine for your code projects.
- A file server for family documents, photos, movies, etc.
- A Sun Ray Server for your family.
- A staging machine for a web presence or service that you host elsewhere.
- A media server for your MP3 or video player in your living room.
- A networked time machine server for your Mac backups.
As you see, there are many things you can do with a home server, and I'm sure you have many ideas yourself. Just make a list of all the things you want to do with your home server as it will give you a sense of the features you're likely going to want when selecting its components.
Next, let's face some common constraints when running a server machine at home:
Potential Home Server Constraints
- Budget: Probably the most common constraint.
- Existing hardware: Do you have some components sitting around that you could reuse?
- Space: Not everyone has a large closet or extra room for running a server at home.
- Noise: If you're forced to run your server where people live, then you want it to be silent.
- Power Consumption: This is like the budget question, but over time, on a yearly basis.
- WAF: Another important constraint, especially when running the machine in the living room!
Again, you may find some more constraints that are important for you.
When purpose meets constraints, you need to prioritize. And more often than not compromises need to be made, goals rethought or constraints re-evaluated (like raising your budget). Here are some features that you want to prioritize:
Home Server Priorities
- Fault Tolerance: What happens if a component fails? (And every component will fail, sooner or later. The question is just how soon and quick you're going to replace it!) In particularly: What if a disk fails? What if two disks fail in a short time span?
- Performance: How important is performance so you can accomplish your server's goals without pulling some hairs off?
- Disk Space: How much net data do you want/need to store on your home server?
I have already assigned some numbers for you, because in my experience, this is the most useful way to prioritize: You never want your precious photos to get lost, disk space is darn cheap (and becomes cheaper every day) and performance is a good thing when transcoding videos, doing high speed backups or running virtual machines.
But again, this is your server, and your priorities may differ and you might have other priorities to sort into the above list.
#2: Check Out Some Cool Home Server Builds
There's a myriad of home servers that have been documented on the web for different operating systems. Here are a couple of interesting OpenSolaris home server builds to look at, in no particular order:
- Rolf Kersten was among the first in Germany to own an Eee PC and boot OpenSolaris from it. Now that his tiny netbook friend has almost retired, he found a way to turn it into an OpenSolaris Eee PC Homeserver.
- Simon Breden's Blog has a number of interesting blog posts about his home server, from choosing components to testing SSDs to setting up OpenSolaris, many interesting aspects are covered.
- Matthias Pfuetzner's recently upgraded home server is very interesting, too. He has blogged a lot about his experience with low-power hardware, booting from compact flash and storing data on USB disks.
- Jan Brosowski's new home server (in German) is powering his Sun Rays at home, virtualizing desktop machines and a few other tasks.
- Tim Foster's Home NAS was recently built based on an Atom board and an ION chipset. It's going to store a lot of video soon...
- Chris Gerhard's home server is another Sun Ray installation for the whole family - including Sun Ray picture frames and lots of tweaks for parental controls, GNOME optimizations and other useful stuff.
- Gregor Longariva (blogs in German) recently blogged about his latest home server, including NetATalk and some IPV6 woes.
- Joerg Moellenkamp chose an AMD Phenom for his home server, so he can have enough oomph for multiple virtual machines.
I'm sure there are more interesting OpenSolaris home server setups out there, just have a look around and collect as many inspirations for your own setup as you can!
#3 Find the Right OpenSolaris (or ZFS) Distribution for You
It doesn't have to be the OpenSolaris distribution, there are also some interesting alternatives based on the OpenSolaris source code:
- If you don't want to get all the X/GNOME baggage and prefer a more minimalistic approach, then check out the JeOS project. It stands for "Just enough OS" and features "examples of heavily reduced, text-based, headless server-oriented forms of the Sun-managed OpenSolaris distribution".
- Nexenta is an alternative distribution tailored towards providing an easy to configure NAS-Appliance version of OpenSolaris.
- EON ZFS Storage is a RAM-based ZFS storage appliance running live from CD-ROM, USB or other devices, optimized to give you an embedded NAS storage appliance feeling.
- Check out other OpenSolaris distributions as well.
- And if you don't like OpenSolaris at all, remember that ZFS is also available in FreeBSD as well since 2007.
#4 Become Familiar With OpenSolaris
OpenSolaris is easy to learn if you're already familiar with a variant of Unix or Linux. But it pays off a lot to dig deeper, especially for those topics that are unique to OpenSolaris.
The blogs you see above are a great starting point for many OpenSolaris tips and tricks, and here are a few more:
- The OpenSolaris Community Groups cover a lot of interesting topics around our favourite OS, from Accessibility and Appliances to ZFS and Zones.
- Browse the OpenSolaris Projects and find new stuff to try out.
- Join an OpenSolaris User Group near you and discuss your favorite topics over a beer or two.
- Two books are highly recommended: Solaris Internals
and Solaris Performance and Tools
, and they have a huge wiki with lots of articles to browse. If you're looking for an all-in-one book, then the OpenSolaris Bible
is for you. And if you have a Linux background, then Pro OpenSolaris
is written specifically for Linux users who want to quickly get up to speed with OpenSolaris.
- And don't forget to read the free manual: You'll find everything at docs.sun.com.
#5: Become Familiar with ZFS
ZFS, being probably the most important feature of OpenSolaris, warrants its own tip. Make sure to understand how it works and try it out on some test pools to get a feel for it. Make sure to regularly visit the ZFS Community on OpenSolaris.org and check out the ZFS Best Practices Guide. A while ago, I blogged about "7 Easy Tips for ZFS Starters" and hope you still get a few useful tips out of it. And here's ZFS tip number eight: Scrub your pools regularly.
But in the end, it's your own experience that counts. So dive right into it and collect your own ZFS experience, and feel comfortable with it when setting up pools and filesystems for real.
#6: Use Zones to Manage Your Services
With all the chatter about ZFS, you shouldn't forget the OpenSolaris Zones feature. It is very useful for managing your services, separating applications and setting up secure environments for your users and daemons.
For instance, my own home server has a zone running Mediatomb for serving video files, another one for serving music to my MP3 player, one zone per user as their own sandboxes and so on. Or imagine having a secure externally accessible login zone that is separated from everything else. And you can combine zones with Crossbow and create your own de-militarized zones and multi-tiered network architectures, all inside the same machine!
Once you get the hang of it, working with zones is the natural way to handle almost everything running on your server. And Uli's and Detlef's Container Guide is definitely your friend.
#7: Script Everything
This may be the most important tip of all, and it took me some time to figure it out.
You know how it goes: You install the OS, set up some users, install software, configure everything, tinker with some services, apply patches, etc. But after some time you hardly know what you did. Sure, you wanted to document it. Some time. Yeah, right.
For exactly this reason, I decided to not configure or install anything by hand: Everything is scripted.
And by scripting everything, I really mean everything:
- All users on the system are setup by a script.
- Package repository configurations, software installation, extra software and their configuration are done with scripts.
- Every service is running in a zone (see above) and all zones can be setup and teared down completely automatically.
- Even small things like setting up power management or ZFS auto snapshots are configured with scripts.
- And while we're at it: The Service Management Facility (SMF) offers a lot of scripting opportunities to make your life easier, too!
Good things happen when you script everything:
- You're forced to think before you do. This makes you aware of all the things that you need to configure or figure out when setting up your system.
- You learn a lot about scripting, the way the system works and how to properly set up stuff.
- The scripts become their own documentation: If you later want to know how you did it, you have it all written down, no excuses.
- Your system becomes independent of the installation: Imagine a complete disaster that kills your whole machine. Just set up a new one from scratch, import your data pools (where you should also store all your scripts), start your scripts and you're ready to go again in minutes!
- You become confident: When developing your scripts, you'll do a lot of testing and bugfixing. And once your scripts do what you want reliably, you'll gain a lot of confidence, and a nice sense of fulfillment.
Granted, this takes a lot of time, and the beginning is probably the hardest part. But you'll notice quickly that you can reuse elements of your scripts, or even set up small libraries of frequently used functions and build up your own management infrastructure.
I'll share some of my own scripts in future posts, but I encourage you to develop scripts of your own, so you can learn new stuff by developing them, instead of using pre-canned stuff that you don't fully understand.
Conclusion
Running a home server is more than just serving videos or storing backup data. It's a playground for growing new skills, developing stuff, testing new technologies and learning new stuff. I hope the tips above help you do more of that and get the most out of your OpenSolaris (or other OS based) home server.
Are you thinking about running your own OpenSolaris home server? Or do you run one already? What are your experiences? What's your setup and configuration? What lessons did you learn and what would you do differently if you had to start from scratch? Feel free to share your experience by leaving a comment below.
Stay in Touch!
Did you like this article? Have you found it useful, interesting or entertaining?
Then click here to get free regular updates and help me reach my goal of 500 regular blog readers this summer!
Thank you for reading Constant Thinking.















Comments
Not just at home
All of the scripting advice applies to the office as well. Good points.
Use standard packages wherever possible. If something is available as a package, use it if you can. Unless you like building packages or want to learn. A package let you easily uninstall. Make install will install it, but uninstalling usually means manually tracking everything down.
I don't want to compile/install, but some things are not available. I run apcupsd to monitor the UPS and shutdown if power goes out. I haven't seen a Solaris package yet.
Get a UPS that your system monitors. It's not to keep running your system when the power goes out. It's to do a graceful shutdown when the power goes out. Or isolate your server when the power drops for 10 seconds. It's worth $100 to not have to debug a crashed system.
Monitor your system for errors. logwatch will check & send an email on status every day.
Good advice!
Hi Tom,
thanks for your advice!
The good thing about installing packages into zones (one per "service" you want to implement) is that you don't need to take care of uninstalling the package. Just delete the zone!
Googling "apcupsd Solaris" produces a few results that seem to be useful, but I haven't tracked them down for real yet. I'll definitely get one of those in the coming months, although powerouts are very, very uncommon here in Munich.
Watching log files and other interesting stuff (like file system usage) are on my to-do-list for scripts. I'll check out logwatch although I like writing my own scripts for the learning experience.
Again, thanks for the additional tips,
Constantin
Add individual software by using sourcejuicer + spec-files-extra
Hi,
I would recommend to enhance your home server with software ready packaged by the sourcejuicer project here: http://hub.opensolaris.org/bin/view/Project+sourcejuicer/ - binary packages are availably by the /contrib IPS repository.
And if the needed software is not in there, you may start writing a spec file for it and submit this to sourcejuicer.
Alternatively you may look at the roots of sourcejuicer's build toolkit which is http://pkgbuild.sourceforge.net and maintains an also very active repository of build recipes (around 1000) here: http://pkgbuild.svn.sourceforge.net/viewvc/pkgbuild/spec-files-extra/trunk/. You compile the packages on your own by firing a simple build command like "pkgbuild --download --autodeps build SFEpostfix". Again, if you may want to write your own build recipes (RPM style .spec files) and submit them. An automated setup of the build environment (e.g. in a Solaris Zone) is possible by the script http://tinyurl.com/bootstrap-sfe-latest-os20nn .
Recordings of a MUCOSUG meeting about sourcejuicer and spec-files-extra are available as well as a paper from a tutorial from the OpenSolaris Developer Conference 2009 in Dresden: http://www.OSDevCon.org
It's worth an extra blog entry this wonderful world of re-usable build recipes :-)
Thomas
Will do!
Hi Thomas,
thanks for the SourceJuicer writeup and recommendation. This is definitely stuff for its own blog article, once I've gotten around to submit some stuff to contrib myself :).
Cheers,
Constantin
Scripting references?
Hi,
just wondering if you have links to any recommended scripting sites?
cheers,
Matt
Learning by doing (and copying)...
Hi Matt,
honestly, the way I taught myself scripting was by looking at other scripts and by practicing.
There are a lot of good scripts related to SMF methods in /lib/svc/method, I suggest you start there (it's the equivalent (but better) to /etc/init.d in OpenSolaris).
Other good sources for scripting wisdom are Chris Gerhard's blog and Tim Foster's blog. They are masters of scripting and you can learn a great deal from them.
If you're still looking for a book, I'd browse around O'Reilly's selection. I don't have a shell scripting book from them, but I'm learning Python with their books and they're very good.
Hope this helps,
Constantin
Excellent, thanks, I will
Excellent, thanks, I will check out those suggestions.
Nah, I don't need a physical book - I'll never sit down to read it ;)
Actually.. reading the other comments here reminded me - I am interested in monitoring and email notification (which I guess will either be a collection of scripts or a package or two) .
Is there much involved? Possibly an extra tip or a separate topic? :)
Matt
Probably stuff for a later post.
Hi Matt,
I haven't yet gotten around to implement monitoring on my server. I just log in regularly, check my pools and /var/adm/messages.
But this is definitely on my todo-list and I'll prefer to do that with a home-grown script so I can learn stuff. Of course, I'll blog when it's done :).
Cheers,
Constantin
Interesting!
Very interesting post!
I would be very interested if you could share some of your scripts or parts of them. Or maybe write a post or two to show some of the tricks you use in them.
Coming up...
Hi Jean-Francois,
thanks! Yes, I plan to publish some of my scripts. I just need to clean them up a bit first :). They're work in progress, but may still be useful, after all, they did work for me...
Stay tuned.
Cheers,
Constantin
Text Installer
Don't forget the new text based interactive installer. http://genunix.org/ has the images. The installed image is very different to the LiveCD and excludes a lot of the X/GNOME packages (there's a few bugs in what's being packaged, but it's definitely thinner).
Cool!
Hi Glynn,
thanks for pointing this out. This sounds like a much better install experience for home servers!
IMHO, the whole packaging hierarchy needs to be more friendly towards installation variants. Imagine a nice JeOS install, then you install Java so you can run an app server and before you know it, you end up having half of GNOME again because Java happened to have an X dependency and so on (yes, I'm exaggerating, but only to make the point clearer :) ).
Are the install/pkg folks thinking about relaxing dependencies?
Cheers,
Constantin
alternative ipkg based mini distro
In addition to the distro's you mention above, we have also created Velitium - an embedded kit for opensolaris. Unlike EON, which is based on SXCE, Velitium allows you to build an embedded ram based image (with out without compressed loopback /usr) directly from the opensolaris package repository.
http://sourceforge.net/projects/velitium/
Originally, it was created for NAS h/w such as those from Thecus, but can be customised for pretty much any combination of supported hardware.
Each release gets slightly smaller, and we are aiming for a true micro install later in the year. A web GUI is on the way too.
Cheers,
Darren
Velitium
Hi Darren,
thanks for posting the link to Velitium. This certainly sounds like a very nice distribution to try out!
Cheers,
Constantin