Category Archives: NAS

Setting up a Crashplan FreeNAS Plugin Jail

Overview

I back up about 400 Gigabytes of photo RAW files and Lightroom (LR) catalogs to the cloud using CrashPlan. I used to have these files on a single hard drive inside my computer – dangerous!

I realised that I needed my photo files on a RAID array so that I don’t lose everything in case of a single disk failure. Instead of putting a RAID array inside my PC, or directly attaching a RAID array to it using USB or Thunderbolt (called a “DAS” for “directly attached”), I realised I didn’t need to spend money when I already have a perfectly good RAID box already – my NAS running FreeNAS!

I had a rude shock though when it came to backing up with CrashPlan running on my PC, and having my work files on a mapped network drive. CrashPlan refused to touch the files on the mapped network drive! I then to take the plunge and move the CrashPlan engine to my NAS, and do back ups from there. Brilliant!

About Running CrashPlan “Headless”

CrashPlan has two basic parts – the CrashPlan application, and the CrashPlan engine. The engine runs continuously and backs up even when the client isn’t running. The client just checks the engine status, and is used to configure it. The Client app is designed to connect to an engine on the local machine and not on a remote machine. Luckily it uses TCP ports, so we can hack the configuration in order to get it to connect to a remote (headless) machine.

Install the CrashPlan Plugin Jail

Setup you jail configuration, if you haven’t already. Mine is as follows:

jail configuration

Install the CrashPlan plugin jail by going to “Plugins > Available” and then highlighting “CrashPlan” and then clicking the “Install” button.

After it has installed, map the files you want to back up into the jail under “View Jails > Storage”. You’ll find detailed instructions on this on the FreeNAS documentation homepage.

My jail storage is as follows:

jail storage

“volume1” is my raid array volume, and “lacie” is an external 12TB USB3.0 drive volume. I initially decided to use CrashPlan to back up all my files (software, multimedia and music) to my external drive, but I found that too slow. Now I just have a backup set to back up my “RAW files” and “Calalogs”, which are contained within my “/software/photography”, as I didn’t want to create another dataset just for those two.

It makes sense to only map your source files as read-only as I have done here – no need to give CrashPlan more permissions than it needs to do its job, and safeguards the files in case something goes drastically wrong. Mapped like this – you can only trash your backups, and not the source.

Update the Plugin Jail

I usually run the following for any new jail to get it up to date:

pkg clean     # clean out old cache
pkg update    # gets the latest list of files
pkg upgrade   # updates the jail software

I also like to install bash with “pkg install bash” and then log out and back into the jail under bash:

sarlacc# jls
 JID IP Address Hostname Path
 1 - crashplan_1 /mnt/volume1/jails/crashplan_1
 2 - dnsmasq /mnt/volume1/jails/dnsmasq
 3 - plexmediaserver_1 /mnt/volume1/jails/plexmediaserver_1
 4 - sabnzbd_1 /mnt/volume1/jails/sabnzbd_1
sarlacc# jexec 1 bash
[root@crashplan_1 /]#

Configure SSH in the Plugin Jail

You’ll need SSH in order to connect your PC to the CrashPlan engine running on the NAS. This is quite straightforward:

Edit “/etc/ssh/sshd_config" and uncomment/edit as follows:

PermitRootLogin yes
PasswordAuthentication yes
AllowTcpForwarding yes

For more security you can create another user such as “adduser crashplan” or “adduser backupuser” etc, but I don’t bother – I just use the root user and set a strong root password (in the jail) with “passwd root” command.

Next get sshd going:

sysrc sshd_enable=YES  # allows sshd to be started as a service
service sshd keygen    # generate sshd keys
service sshd start     # start the sshd service
service sshd status    # check sshd service status - should return the process ID

Update and Start CrashPlan Engine in Plugin Jail

The current problem we face is that the plugin is only version 3.6.3_1, and that’s way behind the exiting GUI version of 4.7, and there are compatibility issues. No problem – just manually update the jail:

su -                    # if not already root
cd /usr/pbi/crashplan-amd64/share/crashplan
wget --no-check-certificate https://download.code42.com/installs/linux/install/CrashPlan/CrashPlan_4.7.0_Linux.tgz
tar -xf CrashPlan_4.7.0_Linux.tgz
cd crashplan-install
cpio -idv < CrashPlan_4.7.0.cpi
service crashplan stop
cd ..
rm -r lib*
cp -r crashplan-install/lib* .
sysrc crashplan_enable=YES

The above assumes that 4.7 is the latest version, and that the crashplan TARGETDIR is “/usr/pbi/crashplan-amd64/share/crashplan“. Check the install vars here:

root@crashplan_1:/usr/pbi/crashplan-amd64/share/crashplan # cat install.vars 
TARGETDIR=/usr/pbi/crashplan-amd64/share/crashplan
BINSDIR=/usr/pbi/crashplan-amd64/share/crashplan/bin
JAVACOMMON=/usr/pbi/crashplan-amd64/linux-sun-jre1.7.0/bin/java
APP_BASENAME=CrashPlan
DIR_BASENAME=crashplan
JRE_X64_DOWNLOAD_URL=http://download.code42.com/installs/proserver/jre/jre-7u45-linux-x64.tgz
JRE_I586_DOWNLOAD_URL=http://download.code42.com/installs/proserver/jre/jre-7u45-linux-i586.tgz

you may have to change “JAVACOMMON=/usr/pbi/crashplan-amd64/share/crashplan/jre/bin/java” to: “JAVACOMMON=/usr/pbi/crashplan-amd64/bin/java” if you get an error message in /var/log/crashplan/engine_error.log complaining about “libjli.so”

How I found the correct java:

[root@crashplan_1 /usr/pbi/crashplan-amd64/share/crashplan]# find / -name "java"
/usr/pbi/crashplan-amd64/linux-sun-jre1.7.0/bin/java
/usr/pbi/crashplan-amd64/share/java
/usr/pbi/crashplan-amd64/share/crashplan/jre/bin/java
/usr/pbi/crashplan-amd64/bin/java

/usr/pbi/crashplan-amd64/linux-sun-jre1.7.0/bin/java -version   Java(TM) SE Runtime Environment (build 1.7.0_51-b13) 
/usr/pbi/crashplan-amd64/share/java -version  directory
/usr/pbi/crashplan-amd64/share/crashplan/jre/bin/java -version   - breaks with libjli.so issue
/usr/pbi/crashplan-amd64/bin/java -version   (build 1.7.0_51-b13)

Go to Plugins > CrashPlan, in the left hand side tree menu in order to accept the Java licence agreement. This trips a lot of people up.

Now start Crashplan

 service crashplan start

You can check that CrashPlan is running with the following:

root@crashplan_1:/mnt/lacie # sockstat -4 | grep java
root java 4859 88 tcp4 10.69.10.24:10303 103.8.239.9:443
root java 4859 105 tcp4 127.0.0.1:4243 *:*
root java 4859 108 tcp4 127.0.0.1:4243 127.0.0.1:12317
root java 4859 119 tcp4 10.69.10.24:56178 216.17.8.11:443

Line 2 is a connection to 103.8.239.9, which is Code42 Australia, where I am backing up some files to.
Line 3 is listening on the local server for new connections.
Line 4 is a an SSH port map from my Windows PC where I run the GUI. We’ll get to that.
Line 5 is a connection to  216.17.8.11 , which is Code42 (makers of CrashPlan) in the USA. Possibly a license server.

Don’t be alarmed when you see “crashplan is not running”, when issuing a “service crashplan status”. If Java is listening on the 4243 port then it should be fine. 🙂

Configure SSH in Windows

I use a program called SecureCRT to easily setup the portmap, connecting to my jail IP of 10.69.10.24, and CrashPlan port of 4243, using local Windows port of 4200:

Crashplan port forward secure CRT with crashplan settings

It’s handy to create a save a session for this, and then create a desktop shortcut to the session, so you can just double-click the icon and start it. I like to start it minimised. The target for the shortcut for me is “C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe" /S "CrashPlan

NB: Check that 4243 is actually your CrashPlan engine port, with the “sockstat -4 | grep java” command above.

Connecting Windows CrashPlan Client to FreeNAS CrashPlan Engine

After setting up the portmap, we need to finish off by connecting the Windows Client to the FreeNAS server. To do this we need to update the following file:  “C:\ProgramData\CrashPlan\.ui_info” changing port and API key.

e.g. from:

4255,736d39b8-5de2-4aa7-9ef9-67bc5d7177e5,127.0.0.1

to

4200,e047e36f-beef-42a4-babe-3b8eff05cafe,127.0.0.1

The format is <local port>,<api key>,<IP address>. Where is the API key you might ask? Answer – from the server’s .ui_info file. Run this on the FreeNAS box to check:

cat /var/lib/crashplan/.ui_info

You can double check the server’s port config there.

Once the Windows “.ui_info file” is saved, you should now be able to start the CrashPlan application on your PC and connect to the server.

The .ui_info file reverts back to the previous settings on every reboot of Windows. It is therefore important to create a .bat file to update this on reboot.

Windows Batch File

  1. Copy your newly configured “.ui_info” file to a new file called “freenas.ui_info” in the same directory.
  2. Create a file called “cpcfg.bat” (short for “crashplan configuration”) in the same directory, with the following contents:
    copy C:\ProgramData\CrashPlan\FreeNAS.ui_info C:\ProgramData\CrashPlan\.ui_info
  3. Create a shortcut to that same cpcfg.bat file in the same folder.
  4. Once the shortcut has been created, right-click the file and select Cut.
  5. Press the WindowsKey+R to get to the “Run” dialog box.
  6. Type “shell:startup” in the Run dialog box and hit “OK”.
  7. Paste your “cpcfg.bat” shortcut into that folder.
  8. Right-click on the shortcut and go to “Properties > Shortcut (tab) > Advanced, and click “Run as Administrator”, and then OK, Apply, OK, to save.

Now everytime you reboot, that file will have the correct info. If that doesn’t work then you’ll have to just manually run the .bat file.

Troubleshooting and Tips

I did the following when I was troubleshooting, just following tips on forums, as you do. I’m not sure if they made my setup work or not, but if you have trouble, then it doesn’t hurt to try the following on the server, within the CrashPlan plugin jail:

ln -s /usr/local/bin/bash /bin/bash
/usr/bin/cpuset -l 0 /usr/local/share/crashplan/bin/CrashPlanEngine restart

In the GUI you can doubleclick on the CrashPlan “House” and logo on the top right and bring up the GUI CLI. Type “connection.info” and you should see something like this:

connection.info 

Address=127.0.0.1
Port=4242
UI Port=4243
HTTP Port=4244

Address=127.0.0.1 and UI Port=4243 is correct if you’re mapping local port 4200 to server port 4243

CPU

Big tip here is to set the CPU usage to 100% (for user present and idle) in the FreeNAS GUI. This is because FreeNAS does CPU management for jails, and 100% within the jail means about 60% overall. The more CPU you throw at it, the better.

It does help to have a very grunty box when creating local backups at speed. I found that my speeds went up, the more I ramped CPU up to 100%, so it’s definitely CPU-bound. I get about 325Mbps  (bits not bytes) to my external Lacie 12TB box over USB3.0 (5Gbps throughput). That would definitely go up with more CPU clock cycles.

Compression

There’s no need to compress your files within the jail, if you’ve already turned compression on at the dataset level. You’re just wasting your time and CPU otherwise. It is good to compress when going over the Internet though, so save your network bandwidth.

Credits

This draws heavily from these two links:
Using CrashPlan On A Headless Computer
FreeNAS Forums: CrashPlan 4.5 Setup

 

Replacing a Failed Drive on a Gen8 HP Microserver Running FreeNAS

I recently had one of my freeNAS9.3 report the following issues:

  • CRITICAL: Device: /dev/ada2, 8 Currently unreadable (pending) sectors
  • CRITICAL: Device: /dev/ada2, 8 Offline uncorrectable sectors

unreadable sectors

After a bit of reading I decided it best I replace the drive, as I don’t want to take chances since I’m only running RAID-Z1 (for the space), instead of the preferred and safer RAID-Z2.

Then I hit a problem: What physical drive is ada2?  The Gen8 HP Microserver G2020T doesn’t have drive lights to indicate which ones are active.

What I did was took a bit of a pun that the drives are numbered left to right, and it proved correct.

What you really need to do before doing anything, is take a screenshot of the different drive serial #’s. Don’t rely on the drive numbers!!! The reason I say that is because once you pull out a drive, the drive numbers get remapped! When I pulled out ada2, what was previously ada3 became the new ada2! This can get confusing and cause you to pull the wrong drive and screw your data – so concentrate on the serial numbers.

I don’t need to repeat the full instructions, but will link you to them here: http://doc.freenas.org/9.3/freenas_storage.html#replacing-a-failed-drive

Here’s my screenshot of my drives. Note the serial of ada2.

Pre drive replace

I now offlined ada2 and shutdown FreeNAS in order to pull the drive out, as the drives in the Gen8 HP Microserver are apparently not hot-swappable (that’s something they really should address!). I booted up to make sure that the correct expected drive SERIAL NUMBER disappeared. Notice how what was ada3 is now ada2.

Post drive pull

Happy that I have pulled the right drive, I now proceed to shut down again, and then insert the new 4TB Seagate NAS drive. After booting up again:

New drive inserted

OK so far so good. I now highlighted the new ada2 as per the screenshot, and then clicked on “Replace”. I then had to confirm that I wanted to replace the original ada2, but I didn’t get a screenshot of that. It then went about reslivering, which is the process of recreating the data on the redundant drive.

resilvering

For me it got up to about 5% after 10 mins, so figured it would take somewhere between 3 and 4 hours, so kicked it off before I went to bed. The interesting thing is that the old drive’s volume ID (8482932750830730262) is still listed in the array during the resilvering process. It’s as if you can cancel the resilvering and go back to the original drive if you so wished (if you had a failed resilver perhaps?) but I didn’t test this theory. Once resilvering is complete, this old drive/volume reference goes away.

Hope this helps. Happy and safe NASing!

 

Update: 20 August 2015.  There was an a file in my /tmp directory called “.smartalert” which seemed to contain the source of the alert. I deleted that file and rebooted, and the alarms cleared.

 

Installing Mythweb into Your FreeNAS MythTV Jail

In my last blog I showed how I installed a MythTV backend PVR server into a FreeNAS Jail.

A must-have for usability is the Mythweb HTTP-based configuration tool. There’s a lot of hoops to jump through, but you should hopefully make it through unscathed!

Install Mythweb and Dependencies

pkg install mythplugin-mythweb

For me this says that it will install the following:

New packages to be INSTALLED:
 mythplugin-mythweb: 0.27_1
 php56-session: 5.6.7
 php56: 5.6.7
 apache24: 2.4.12
 php56-posix: 5.6.7
 php56-json: 5.6.7
 php56-mysql: 5.6.7

Since it is installing PHP 5.6, you’ll need the “56” version of mod_php as well:

pkg install mod_php56

There are important messages from the installs (shown here) which we’ll address below:

Message for apache24-2.4.12:
To run apache www server from startup, add apache24_enable="yes"
in your /etc/rc.conf. Extra options can be found in startup script.

Your hostname must be resolvable using at least 1 mechanism in
/etc/nsswitch.conf typically DNS or /etc/hosts or apache might
have issues starting depending on the modules you are using.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- apache24 default build changed from static MPM to modular MPM
- more modules are now enabled per default in the port
- icons and error pages moved from WWWDIR to DATADIR
 If build with modular MPM and no MPM is activated in 
 httpd.conf, then mpm_prefork will be activated as default
 MPM in etc/apache24/modules.d to keep compatibility with 
 existing php/perl/python modules!
Please compare the existing httpd.conf with httpd.conf.sample
and merge missing modules/instructions into httpd.conf!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Message for mythplugin-mythweb-0.27_1:
mythweb has been installed into:
 /usr/local/www/mythweb
You need to configure mythweb now according to the instructions in
 /usr/local/www/mythweb/INSTALL
For lighttpd you should have a look at the MythTV Wiki
 http://www.mythtv.org/wiki/MythWeb_on_Lighttpd

Message for mod_php56-5.6.7:
***************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
<FilesMatch ".php$">
 SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".phps$">
 SetHandler application/x-httpd-php-source
</FilesMatch>
***************************************************************

Server-Wide Config

Update “/etc/rc.conf" with the following:

apache24_enable="YES"

Update “/etc/hosts" to something similar to the below – changing the parts in red to suite your IP, hostname and domain:

127.0.0.1 localhost localhost.localdomain mythserver mythserver.gavowen.local
10.69.10.22 mythserver mythserver.gavowen.local

Mythweb Config

You can choose to put your mythweb into the root of the web server, but I prefer to put it off to the side it its own “mythweb” directory.

Copy the mythweb files to where the web server can use them:

mkdir /usr/local/www/apache24/data/mythweb
cp -R /usr/local/www/mythweb/* /usr/local/www/apache24/data/mythweb

Apache 2.4 runs as user and group “www” on FreeBSD/FreeNAS, so update the permissions accordingly:

chgrp -R www /usr/local/www/apache24/data
chmod -R g+rw /usr/local/www/apache24/data

TV Icons

I copied mine into my jail, then across to MythWeb’s TV icons directory:

cp /mnt/storage/channelicons/* /usr/local/www/apache24/data/mythweb/data/tv_icons

Mythweb Apache Config File

The Mythweb Apache config file (“/usr/local/www/apache24/data/mythweb/mythweb.conf.apache“) is a bit out of date for Apache 2.4 and PHP 5.6, so pull down the latest version directly to the directory you need it in.

cd /usr/local/etc/apache24/extra/
wget --no-check-certificate https://raw.githubusercontent.com/MythTV/mythweb/master/mythweb.conf.apache
cp /usr/local/etc/apache24/extra/mythweb.conf.apache /usr/local/etc/apache24/extra/mythweb.conf

Edit the “mythweb.conf" file and change the following:

<Directory “/var/www/html/data”>
to
<Directory “/usr/local/www/apache24/data/mythweb/data”>

and
<Directory “/var/www/html”>
to
<Directory “/usr/local/www/apache24/data/mythweb”>

My NAS has plenty of RAM, so I increase the PHP “php_value memory_limit” to 256M. Save the file and quit.

Make sure these lines are uncommented:

 setenv db_server "localhost" 
 setenv db_name "mythconverg" 
 setenv db_login "mythtv" 
 setenv db_password "mythtv"

Apache Config

Backup Apache’s original config file before editing “httpd.conf":

cp /usr/local/etc/apache24/httpd.conf /usr/local/etc/apache24/httpd.conf.original

Uncomment all these mods. The first two are usually on by default:

mod_env
mod_headers
mod_rewrite
mod_deflate
mod_auth_digest

Uncomment ServerName and change it to match what you’ve done previously in “/etc/hosts" e.g.:

ServerName mythserver.gavowen.local:80

In the “Supplemental Configuration” of the file, I place the following two lines:

# Mythweb configuration
Include etc/apache24/extra/mythweb.conf

Further down you’ll find the DirectoryIndex, where I add “index.php”

<IfModule dir_module>
 DirectoryIndex index.php index.html
</IfModule>

Directly below that part I add the following:

<FilesMatch ".php$">
 SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".phps$">
 SetHandler application/x-httpd-php-source
</FilesMatch>

Restart Apache:

service apache24 start

Now open a browser. Enjoy.

NB: Subsequent restarts of apache can be done with “apachectl graceful"

Troubleshooting

If the page doesn’t load try this:

create user 'mythtv'@'127.0.0.%' identified by 'mythtv'; 
create user 'mythtv'@'127.0.1.%' identified by 'mythtv'; 
set password for 'mythtv'@'127.0.0.%' = password('mythtv'); 
set password for 'mythtv'@'127.0.1.%' = password('mythtv'); 
connect mythconverg; 
grant all privileges on *.* to 'mythtv'@'127.0.0.%' with grant option; 
grant all privileges on *.* to 'mythtv'@'127.0.1.%' with grant option; 
flush privileges; 
exit;

There are other possible issues addressed at this link.

Time Issue

You might get a warning such as:

User Notice at /usr/local/share/mythtv/bindings/php/MythBackend.php, line 132:
 !!NoTrans: Failed to set php timezone to AEST Response from backend was Array ( [0] => AEST [1] => 36000 [2] => 2015-04-25T10:14:06Z ) !!
 Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/www/apache24/data/mythweb/includes/errors.php on line 161

If that’s the case I find installing NTP a good solution:

pkg install ntp

Update “/etc/rc.conf" with the following:

ntpd_enable="YES"

Then start it with “service ntpd start". Issue “date" to see that it’s accurate. Then:

cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

search for “date.timezone” and change it to suit. For me it’s date.timezone = "Australia/Melbourne"

 

HP Microserver Gen8 FreeNAS Tips and Tricks

Well I’ve been spending some time with the new HP Microserver Gen8 (G2020T), and wanted to post a few little tips and tricks for using it with FreeNAS

  1. Make the internal USB slot external
  2. Use MicroSD for swap space
  3. Bind CIFS to certain interfaces

Make the Internal USB slot External

With my older HP N40L NAS I was used to accessing the bootable internal USB by opening the front door. With the new NAS, you can’t get to the internal bootable USB without taking the case cover off. I had a spare USB extension cable so I put it to work as per the following photos:

I can now sit it on top of my NAS which gives me the following benefits:

  1. I can get to it easy. The rear USB2 are practically blocked by the two NIC ports I’m using, so I don’t have to reach around the back to get to them.
  2. It keeps the two front USB ports clear, so I don’t have a stick jutting out, and I can keep them free for if I need to plug in a mouse and keyboard.

Just so you know, you can boot from the external USB ports – the USB2 ones at least. I’m pretty sure I read somewhere that you can only boot from USB2 though – the USB3 ports are made available via OS drivers post-boot. It was quite easy to bend back the bit of metal and feed the plug through.  BTW – you can see my Intel 2-port server NIC there that I use to team two interfaces into my ESXi box for iSCSI disks straight off the NAS.

Use the MicroSD for the FreeBSD/FreeNAS OS Swap Space

This is my favorite tip. See the MicroSD card slot on the photo above? I thought about what use that could be for a dedicated NAS box, where I boot off the USB drive and use the HDD array for storage – surely it’s useless? Well I found a use for it that I’m quite happy with.

What I didn’t know is that by default, not all of your HDD space is used for data storage. In the default settings of FreeNAS (8 and now 9.1) is that it reserves 2GB per-disk for OS swap space.

Where it’s set is SETTINGS -> ADVANCED… “Swap size on each drive in GiB, affects new disks only. Setting this to 0 disables swap creation completely (STRONGLY DISCOURAGED).”

Here is a discussion on the matter.  If a disk fails and you’re using the swap space on it, that could leave your server inoperable. I don’t like that sound of that. What you can do is use the MicroSD for OS swap. This will then leave your HDD’s purely for ZFS data storage.

There are new MicroSD cards from Sandisk  (the creators of the format) that can transfer up to 80MB/s that should be adequate for emergency swap space. Mind you I say “emergency” swap. I am using my box as a NAS with 8GB and soon to be 16GB RAM – I don’t expect to be using swap at all, but like to have it for any emergency needs, which is preferable to the server crashing.  If you are smashing the swap space, then you’d need more RAM, and if you’re still smashing it, then perhaps get a dedicated SSD that can sit in the thin optical drive bay (there are third-party solutions for this).

To set this up this is what you do:-

Set swap size on each drive to “0” before you create any ZFS volumes! Otherwise you’ll have to blow those away and start again.

Put the MicroSD card in. I’m not sure if it’s hot swap, but since it’s a one-off task I do it cold. You can can either check the “dmesg” or via the GUI check that it shows up as a drive. On FreeNAS 9.1 it shows up on my server as “da1”.

On the CLI you type:

swapon /dev/da1

Check that it’s using it:

freenas# swapctl -l
Device:       1024-blocks     Used:
/dev/da1         992000         0

That’s a tiny 1GB MicroSD I pulled from a mobile phone as I didn’t have any others spare. I’ll put the order in for a 16GB Sandisk Extreme soon enough. I think it’s good form to be at least as big as the size of your RAM.
You also need to make sure it enables the swap on boot, so in the FreeNAS web GUI in “System” then under the pre-init scripts section, add a new pre-init script of:

swapon /dev/da1

If your ZFS volumes already have swap on them you might see something like this:

 freenas# swapctl -l
 Device:       1024-blocks     Used:
 /dev/ada0p1.eli   2097152         0
 /dev/ada1p1.eli   2097152         0
 /dev/ada2p1.eli   2097152         0

…because /etc/fstab will have these entries:

 freenas# cat /etc/fstab
 /dev/ufs/FreeNASs1a / ufs ro 1 1
 /dev/ufs/FreeNASs3 /cfg ufs rw,noauto 2 2
 /dev/ufs/FreeNASs4 /data ufs rw,noatime 2 2
 /dev/ada0p1.eli none                    swap            sw              0       0
 /dev/ada1p1.eli none                    swap            sw              0       0
 /dev/ada2p1.eli none                    swap            sw              0       0

You’ll need to build your volumes from scratch to get rid of that swap, unless you know how to hack this and extend the ZFS volume(s) to fill that extra space, which sounds problematic for live data. For me I copied the data off and rebuilt the volumes and datasets, just to be safe.

Bind CIFS to Only Certain Interfaces

With the extra NIC that I didn’t have before, I decided to use the extra port for “Out of Band Management”. This is handy for security so that only computers on the OOBM network can access the web GUI (if you pin the web GUI to a certain IP address). It’s good practice to have all your network devices managed this way where possible. I like to use the default VLAN for this, with general data on VLAN10 and voice traffic on VLAN20, and if I have a dedicated “SAN” (with jumbo frames usually), then I use VLAN30 for this.
Of course I could have set this up previously with VLAN interfaces which is fine from a security perspective, but I do like the idea of OOBM being on a totally separate physical interface for a pure OOBM setup.

You can either bind Samba to individual interfaces, or a range of interfaces by specifying a network. The latter is my preference as it requires less thought. The commands I  use are:

interfaces = 10.10.10.0/24
bind interfaces only = yes

Where you apply this is under “Services –> CIFS –> Auxiliary parameters

That subnet listed is what I have on my data VLAN10. It’s good for me as my PC has NICs on both Data and OOBM, and means I don’t accidentally mount Samba shares across the OOBM network. BTW that “interfaces” statement doesn’t have to match the subnet mask of your interface. You can just have written “10.0.0.0/8” which depending on your setup might match one or more interfaces. Otherwise you can specify interface names like “bge0”, or “em0” – i.e. the OS-given device name – not the name you gave it with the FreeNAS web GUI.

FreeNAS USB3.0 on the New HP Gen8 G2020T Microserver

Well the long-running saga of not having any working USB3.0 on my microserver NAS continues. In my previous post I said “It works perfectly”. Well when I dug a bit further I found that to not be the case. I assumed quite incorrectly that since the 4TB Seagate Expansion Desktop spun up, that it was working at USB3.0 speeds. Bad assumption.

To recap, I needed an external disk drive to my NAS so I can backup files from the NAS using ZFS snapshots that I can browse through with Windows VSS.

Here’s what happens when I plug into Renesas D720201-powered USB3 card:

 umass1: <vendor 0x0bc2 product 0x3312, class 0/0, rev 3.00/3.19, addr 1> on usbus0
 (probe0:umass-sim1:1:0:0): INQUIRY. CDB: 12 00 00 00 24 00
 (probe0:umass-sim1:1:0:0): CAM status: CCB request completed with an error
 (probe0:umass-sim1:1:0:0): Retrying command
 (probe0:umass-sim1:1:0:0): INQUIRY. CDB: 12 00 00 00 24 00
 (probe0:umass-sim1:1:0:0): CAM status: CCB request completed with an error
 (probe0:umass-sim1:1:0:0): Retrying command
 (probe0:umass-sim1:1:0:0): INQUIRY. CDB: 12 00 00 00 24 00
 (probe0:umass-sim1:1:0:0): CAM status: CCB request completed with an error
 (probe0:umass-sim1:1:0:0): Retrying command
 (probe0:umass-sim1:1:0:0): INQUIRY. CDB: 12 00 00 00 24 00
 (probe0:umass-sim1:1:0:0): CAM status: CCB request completed with an error
 (probe0:umass-sim1:1:0:0): Retrying command
 (probe0:umass-sim1:1:0:0): INQUIRY. CDB: 12 00 00 00 24 00
 (probe0:umass-sim1:1:0:0): CAM status: CCB request completed with an error
 (probe0:umass-sim1:1:0:0): Error 5, Retries exhausted
 ugen0.2: <vendor 0x0bc2> at usbus0 (disconnected)
 umass1: at uhub0, port 1, addr 1 (disconnected)

I also tried another card that has a newer Renesas D720202 chip – same deal. Here’s what happens plugging into USB2

 ugen2.2: <Seagate> at usbus2
 umass1: <Seagate Expansion Desk, class 0/0, rev 2.10/3.19, addr 2> on usbus2
 da1 at umass-sim1 bus 1 scbus7 target 0 lun 0
 da1: <Seagate Expansion Desk 0319> Fixed Direct Access SCSI-6 device
 da1: 40.000MB/s transfers
 da1: 3815447MB (976754645 4096 byte sectors: 255H 63S/T 60800C)
 da1: quirks=0x2<NO_6_BYTE>

The disk shows up fine, but of course is slow being USB2.

Not happy with that, I bit the bullet and bought the new HP G2020T Gen8 Microserver.  It was a big outlay but when an issue gets under my skin like this – I go all out! I was hoping that somehow it was the Renesas line of chipsets at fault not being properly supported in FreeBSD/FreeNAS. Surely the Intel native chipset will work?!

As an aside, when I was swapping disks over from my old NAS I dropped a disk and it was a write off. I ended up buying four new 4TB Seagate NAS drives as I’m a big fan of Seagate’s reliability.

Unfortunately, even with the newly-released FreeNAS 9.1, I still can’t get USB3.0 working with my Seagate external drive, even on the new Gen8 Microserver! I believe it’s an issue with the FreeBSD XHCI USB3.0 driver. I’ll have to run it at USB2.0 speeds for the time being and keep an eye on the errata for new versions of FreeNAS.

Update: in my new Gen8 Microserver with FreeNAS, I have a MicroSSD card and it shows up as “da1”, and the external USB2 drive shows up as “da2”. In the old NAS, the external USB2 drive shows up as “da1”. Be mindful of this if upgrading NAS and copying your settings across.

Renesas D720201 USB3.0 Card and FreeNAS

I use a HP Microserver N40L for my home NAS, which  run the fantastic FreeNAS operating system and 4x 2TB drives in a RAID-Z2 configuration. I wanted to back up the NAS onto an external drive, with the great feature that is ZFS snapshots.

I started looking at 4TB external drives. The N40L has eSATA and only USB2.0, so I thought that eSATA was my only real option. I quickly learned that eSATA is fast becoming a dead technology, as USB3.0 takes over.

The pure eSATA drives seemed to top out at about 1 or 2TB. The ones that go up to 4TB – the cheapest ones are pure USB3.0. The ones (from Lacie and others) that have eSATA, USB3.0 and FireWire are very expensive, and it is actually cheaper to get a USB3.0-only 4TB drive plus cheap USB3.0 controller card, than it is to get one that supports eSATA. My decision was further solidified by the fact that the new “Gen8” HP Microservers don’t even have eSATA. Buying a USB3.0 controller card became a no-brainer.

I went for a Astrotek 2 Port External / 1 Internal PCI Express USB3.0 Card from the fine folk at Scorpion Technology. The specs as copied from Scorpiontech:

Chipset : RENESAS 720201
PCI Express Base Specification 2.0
2 x USB 3.0 Downstream Port
1 x ICC USB 3.0 (2 x USB 3.0) Internal Downstream Port
1 x ATX Molex Power connector
Compliant with USB specification 3.0 rev. 1.0 compliant
Max. 5 Gb/s transfer rate per port
Supports Super-speed (5 Gb/s), High-speed (480 Mb/s), Full-speed (12 Mb/s), & Low-speed (1.5 Mb/s)
Supports USB 3.0, USB 2.0 & USB 1.1 devices
Compliant with Intel xHCI (eXtensible Host Controller Interface) specifications Revision 1.0
Supports USB Battery Charging Specification Rev. 1.2
Supports PCI Bus Power Management Interface Specification rev. 1.2
Supports USB Wake-up function(total max. 5V/600mA)
1.5A MOSFET Power Switch Protection & Over-current sensing for each port
Supports Hot Swap, Plug & Play
Drivers support Windows XP, Vista, 7, & Server 2008 Release 2 (x86 & x64)
Linux Kernel 2.6.31 native support
Low Profile support

I’ve bolded the items that appeal to me the most.

The Renesas 720201 seems to be one of the best performing USB3.0 controllers, according to a VR Zone review.

Since FreeNAS is built on FreeBSD, any spec sheet that lists an open source OS is good news. I was thus hopeful it would work in FreeNAS.

I plugged in with FreeNAS 8.3 and got no joy. I saw that the card was recognized by the BIOS and was given an IRQ, but it was dead in FreeNAS.  I downloaded a copy of the new FreeNAS 9.1.0RC2 and to my pleasant surprise found that it worked perfectly. Since I’m not ready to upgrade to beta code for my NAS, I’m in for a bit of a wait until I can use my external USB3.0 drive, but shouldn’t take too long.