Tuesday, 24 September 2013

Freenas - Creating Datasets and sharing with CIFS and NFS

What I have done is create several Datasets, for which I can assign different quotas and permissions, for each type of media that I have.

  • 3DMovies
  • Comedy
  • HDMovies
  • Music
  • TVShows

How you set permissions on this is up to you, everyone has different needs. I'm not to bothered about security in my home media set-up as nothing personal is going to be saved here. You can set-up guest access or use local user accounts.

Go to Storage-Volumes-/mnt/<your volume> and select Create ZFS Dataset


Enter a name and click Add Dataset.

For Guest Access to CIFS

Go to Accounts and create a user called guest, add to Primary Group ID of guest and tick Disable Password Login, click OK to create.
Go to Services and select the spanner next to CIFS and change Guest account to the guest user. Save your changes and turn the CIFS service on.
Go to Storage-Volumes-/mnt/<your volume>/<your dataset> and select Change Permissions. Set Owner (user) to guest, Owner (group) to guest, tick write under group and then click change.
Go to Shares-Windows (CIFS) and click New Windows (CIFS) Share. Give the share a name, browse to the Dataset you are sharing and tick both Allow Guest Access and Only Allow Guest Access. Click OK

You should be able to brows this CIFS share as a guest without being prompted to log on.

For Guest Access to NFS

We've already set user permissions on the Dataset for CIFS. With NFS we can decide which workstations or networks (IPs) can use the share as well as which user. 
Go to Shares-UNIX (NFS) and select Add Unix (NFS) Share. Give the share a name in Comment. I add my local network in CIDR form 192.168.2.0/24 to allow everything, set Mapall User and Mapall Group to guest and browse to the Dataset you are sharing. Click OK

In windows you must first install NFS tools then open a CMD and enter:-

showmount -e <ip of your FreeNAS box>

You should see your NFS shares

to mount it in type:-

mount -o nolock \\<IP of FreeNAS box>\mnt\<volume>\<dataset> <drive letter>

You should be able to brows this NFS share as a guest without being prompted to log on.

Configuring FreeNAS via the web GUI - PART 2

Now that you have created an admin user and configured FreeNAS to access the internet we can build our storage. What I have done is create two mirrored Vdevs and added them to both to a ZFS storage pool.

My pool looks like this


This may not be the optimal configuration as my knowledge of ZFS is limited (and existing media on the disks meant I had to juggle it around a bit so could only create one Vdev at a time, copy data to the the new pool, and once the other disks were empty I could extend the pool with a new Vdev). This set-up allows for two disk failures for my pool to remain intact, but only one disk can fail from each Vdev.

There is a brilliant ZFS Presentation created buy a regular contributor to the FreeNAS forums which explains ZFS in a way that is easy to understand. I recommend you read it.

Creating a ZFS Pool

Select Storage-Active Volumes-ZFS Volume Manager. Give your pool a name and add your disks. The manager will automatically assign the optimal Volume layout based on the number of disks you are adding
  • 1 Disk - STRIPE
  • 2 Disks - MIRROR
  • 3 Disks - RAIDZ1
  • 4 Disks - RAIDZ2
  • 5 Disks - RAIDZ3


In my case I called my pool ZFS1 and initially added two disks that were mirrored. I later came back to ZFS Volume Manager and selected ZFS1 as the volume to extend and added a second pair of mirrored disks. This gave me a pool of the size 3.6TB

That's pretty much it. In the next post I discuss creating Datasets and making those Datasets available to your clients via CIFS and NFS shares

Configuring FreeNAS via the web GUI - PART 1

Login to FreeNAS by opening your browser and going to the IP address of your NAS. It will sign you straight in as there are no sign-in credentials. You will have an alert advising you to set these.

FreeNAS home screen
Click on Account (top right) and edit Change Admin User and then Change Password.

Click on Network-Global Configuration enter your IPv4 Default Gateway and Nameservers. This is so FreeNAS can access the internet for plugins (to be covered in a later post).

Under Settings-General set the WebGUI IPv4 Address to be the fixed IP of the NAS box, Change your Timezone (possibly Keyboard Layout) then save.

You can configure FreeNAS to send out email alerts. To do this you have to give the root user an email address (found under Accounts-Users) then complete Settings-Email. If you use gmail then use the following
  • Outgoing mail server - smtp.gmail.com
  • Port to connect to - 587
  • TLS/SSL - TSL
  • Use SMTP Authentication - tick
  • enter your gmail credentials
Click Send Test Mail and if all is well you will get a test mail sent to your gmail account. If this worked click Save.

N36L hardware and installing FreeNAS to a USB flash drive

The Hardware

The N36L Microserver comes with the following specifications
  • Chassis: Desktop
  • CPU: 1.3GHz AMD Athlon II Neo N36L
  • Memory: 1GB 800MHz UDIMM DDR3 expandable to 8GB
  • Storage: 250GB Seagate Barracuda SATA hard disk in cold swap carrier
  • RAID: embedded AMD SATA RAID controller
  • Array support: RAID 0, 1, JBOD
  • Expansion: 2 x PCI Express
  • Ports: eSATA; 7 x USB2 (6 external, 1 internal);
  • Network: Gigabit Ethernet
Unboxed N36L Microserver
There is a custom BIOS update  floating around that allows you change the IDE 5.25 drive bay and eSATA to AHCI. This is recommended as you can then install THIS to take advantage of the empty 5.25 drive bay and install an additional SATA Disk drive. I replaced the 1GB memory with 8GB. I've added 4 2TB green SATA drives and moved the 250GB drive into the 5.25 bay.

The internal USB will be used to boot into FreeNAS installed on a flash drive.

Installing FreeNAS 9.1.1

Download the most recent disk image from HERE (should be a *.xz file) and the tools Win32DiskImager and 7zip and install them. Use 7zip to extract the *.img file from the downloaded *.xz file. Plug your USB flash drive, run Win32DiskImager ans choose the drive letter of your flash drive. Select the Freenas *.img file and click write, wait for the process to finish. You now have Freenas installed on your USB flash drive.

Booting into FreeNAS for the first time

Configure the BIOS of the N36L to make USB the first bootable device, insert your FreeNAS USB flash drive into the internal USB port and turn on the server. All being well after a few minutes you will end up at a menu screen (11 options) and a URL to be able to configure your NAS via a browser. At this point I configure the NAS to have a fixed IP (configured to be DHCP initially).

When you have fixed the IP we can go to a browser to continue to configure FreeNAS

Configuring FreeNAS via the Web GUI - Part 1

Using a HP Proliant N36L Microserver and FreeNAS to build a home media server.

As a media centre enthusiast I have a bunch of different devices running either XBMC or PLEX and I use DNLA for streaming to others. There are several Android phones and tablets, a smart TV as well as Windows and Macs and all these devices need to connect to a central storage hub containing all my media. 
This hub was on my N36L running Ubuntu which provided SAMBA and NFS shares as well as running Sabnzbd, Sickbeard, Plex Server, SubSonic and Logitech Media Server. My storage was 4 x 2GB drives set up as 2 x RAID1 pairs using the N36L RAID controller.
After some thought I've decided to change track and go for a dedicated NAS device and a new server to run ESXi for my OS needs. I'd looked at a few dedicated NAS devices on the market but most are out of my meagre price range. I've known about FreeNAS for some time so gave it a look. It ticks most of my boxes.
  • Affordable
  • CIF and NFS shares
  • Plugins
  • Great online support
I was a little apprehensive about using ZFS as its not as easy to recover from as a simple UFS mirrored disk but I enjoy playing with new tech so gave it a go.

So my plan is to use the N36L as a NAS and a new N50L for ESXi

Saturday, 21 September 2013

Hello World

Done it! my first blog post. I've been holding this off for far too long.