# FreeBSD ZFS NAS with XBMC. Possible?



## vaibhavyagnik (May 8, 2013)

I am going to try and build a NAS-cum-HTPC with the following ideas on top of my head. I will appreciate if somebody gives me pointers if my thinking is in the wrong direction and if what I am trying to do is possible.

Install and boot FreeBSD on a 16[ ]GB thumb drive
Create a ZFS RAID-Z pool of five disks
Create Data sets on the zpool for movies, music and pictures.
Install and configure Xorg with Nvidia drivers (Recommended Nvidia card for HTPC (2D and 3D both) is?)
Install XBMC
Configure XBMC to auto start at startup
Configure XBMC to look for and scrub movies, music and photos on their respective Datasets.
Install and configure Transmission, MiniDLNA, Firefly and Jdownloader, all, on the thumb drive.
I am not looking to install any desktop environment.
For the curious:

Why I want to build a NAS-cum-HTPC?
The hardware that I have chosen is pretty capable
Intel pentium G620
Intel DH67BL with Intel NIC and five SATA ports
16 GB 1333 Mhz RAM (4[ ]GB x 4)
Corsair VX550
Nvidia graphics card on your recommendations.
I find it to be a waste of such powerful hardware to use it as just a NAS, so *I* am thinking to add to its duties.


Why do I want to install FreeBSD, XBMC and others on a thumb drive?
To make things compartmentalized. Let*'*s consider failure scenarios.
Thum*b*drive fails: Replace thum*b*drive, install FreeBSD again and import the Zpool
One of the disk fails: RAIDZ. Replace hard drive. We are good to go.
Underlying hardware fails: Replace the failed component (any changes to be done on freebsd FreeBSD side?)


Basically, I am trying to achieve FreeNAS like functionality with FreeBSD, with HTPC slapped on top.

Let me know your thoughts! You guys are awesome!


----------



## SirDice (May 8, 2013)

vaibhavyagnik said:
			
		

> Nvidia graphics card on your recommendations.


A basic GT430 or GT520 should work fine for XBMC. You should be able to use VDPAU with those cards. Best of all you can probably get one that's passively cooled if you shop around a bit.


----------



## phoenix (May 8, 2013)

The only thing I'd watch out for is noise.  You want an HTPC to be as near to silent as possible.  Especially if watching movies at night with the sound turned down.  There's nothing worse than hearing fan noise in the background while watching a show that has low voice audio and loud FX audio.

If your drives, CPU, PSU, and videocard are quiet, then go ahead and combine the storage and media player.  Otherwise, separate them.

Our previous HTPC had an Athlon64 with stock CPU fan, loud PSU, and clunky IDE disk.  You could hear the PC over the TV, even during movies when using the stereo speakers.

We've since replaced it with an Athlon-II, quiet fans (when it's actually in use, mostly it's off), and SSD.  Now you can't even hear the HTPC when the TV is off.  

As for your failure modes, you can simplify things by doing rsync backups from the thumbdrive into a directory in the pool.  Then, if the thumbdrive dies, just boot from a LiveCD, format new thumbdrive, import pool read-only, rsync data back from pool to thumbdrive, install boot blocks, reboot.  No reinstalls required.  

Or, use 2 and mirror them.  

Eventually, you'll trust ZFS enough that you'll migrate to a root-on-zfs setup and not need the thumbdrives.    I'm almost at that point now ...

Correction ... I've now migrated my home machine to ZFS-on-root (using 2x mirror vdevs and a single pool for everything) and built our latest storage server at work with ZFS-on-root (system pool using mirror of SSD; separate storage pool using harddrives).


----------



## Deathalo (May 28, 2013)

What's the status of this project? Did you succeed in creating this do-all NAS HTPC hybrid?  I would love to know what you did/how you did it, I too am very interested in having one box that contains a ZFS powered-NAS as well as XMBC to output to my TV.


----------



## throAU (May 30, 2013)

+1 to the noise comment

The way I went around this was to use FreeNAS (in another room) with the DLNA plugin and streaming to my PS3. Essentially bulk storage and media playing have a couple of conflicting requirements. Bulk storage requires big PSU, lots of drives, fans, etc. A media box in your theatre wants to be dead quiet.


----------



## Deathalo (May 31, 2013)

The noise is actually a non issue for me, since all my components (including my current NAS and router are in a media closet in the wall behind my TV. There's also plenty of noise suppressing cases and great fans that are much quieter than the one noisy one on my current NAS.


----------



## Blueprint (Jun 11, 2013)

Hi, my home server/HTPC is very similar to what your require and I've been running this setup for three years with no issues. Just recently I updated my documentation with improvements, perhaps it can be useful to you.

http://www.overclock.net/a/freebsd-htpc-and-home-server

Like @phoenix I run a mirrored root pool (on disk), and a separate RAID-Z storage pool for jails and my data.


----------



## vaibhavyagnik (Jun 11, 2013)

Blueprint said:
			
		

> Hi, my home server/HTPC is very similar to what your require and I've been running this setup for 3 years with no issues. Just recently I updated my documentation with improvements, perhaps it can be useful to you.
> 
> http://www.overclock.net/a/freebsd-htpc-and-home-server
> 
> Like Phoenix I run a mirrored root pool (on disk), and a separate zraid storage pool for jails and my data.



Great tutorial! I haven't had the time to initiate the install. Currently the hardware that I mentioned above is running FreeNAS. I will move on to this once I have some time.


----------



## taliz (Jun 25, 2013)

vaibhavyagnik said:
			
		

> [*]Install and boot FreeBSD on a 16 GB thumb drive



I would not recommend installing on a thumb drive, they're dead slow for a full OS and especially with X.Org running on top of it. Get an SSD, they're so cheap now anyways. Also, buy a 10 meter or so HDMI cable and place the server where the sound it makes wont disturb you (with five HDDs it will create some vibrations and noise).

I tried a similar setup a few years ago but it couldn't get it to work properly. Getting sound out via the HDMI port was impossible due to the way the sound system works in FreeBSD (might have changed now though?).
So I ended up with two machines. A C2D based server with fbsd FreeBSD and ZFS for storage, torrents, backups and what not that sits in a corner where it cannot be heard. Plus a tiny quiet Nvidia ION based system that I run OpenELEC on, which is next to the TV. Works perfectly and the HTPC with OpenELEC requires zero maintenance, took five minutes to install, and it even updates itself.


----------



## jalla (Jun 25, 2013)

taliz said:
			
		

> I tried a similar setup a few years ago but it couldn't get it to work properly. Getting sound out via the HDMI port was impossible due to the way the sound system works in FreeBSD(might have changed now though?).


Sound over HDMI works well with NVidia since at[]least a couple of years ago.


> So I ended up with 2 machines. A C2D based server with fbsd and ZFS for storage, torrents, backups and what not that sits in a corner where it cannot be heard. Plus a tiny quiet Nvidia ION based system that I run OpenELEC on, which is next to the TV. Works perfectly and the HTPC with OpenELEC requires zero maintenance, took 5 minutes to install, and it even updates itself.


If all you need to run is xbmc you may even go with the Raspberry PI.


----------



## taliz (Jun 26, 2013)

jalla said:
			
		

> Sound over HDMI works well with NVidia since at[]least a couple of years ago.


It depends on what hardware you got. For example it did not work on the ION 1 platform, but someone reported they got it to work on the ION 2 platform. See:
http://forums.freebsd.org/showthread.php?t=21476
http://forums.freebsd.org/showthread.php?t=28441
https://forums.geforce.com/default/topic/510034/ion/sound-via-hdmi-in-freebsd/



			
				jalla said:
			
		

> If all you need to run is xbmc you may even go with the Raspberry PI.


The RPI does not handle much more than the H/x264 format, plus friends that have bought it have reported sluggish GUIs and other issues that makes it unfit as an HTPC.


----------

