FreeNAS on the ARTiGO A2000

In the following post I’ll go over what it takes to get FreeNAS installed and working on the new ARTiGO A2000.  Since this was my first time ever dealing with FreeNAS I ran into a few glitches along the way.  Lucky for you I’ll outline those glitches below so you can avoid making the same mistakes that I made.  You should have very little trouble getting a full NAS setup up and running on your A2000; pitfalls aside, I was able to get RAID 1 and CIFS set up in little under an hour.

A description of FreeNAS from their Web site:

FreeNAS is a free NAS (Network-Attached Storage) server, supporting: CIFS (samba), FTP, NFS, AFP, RSYNC, iSCSI protocols, S.M.A.R.T., local user authentication, Software RAID (0,1,5) with a Full WEB configuration interface. FreeNAS takes less than 32MB once installed on Compact Flash, hard drive or USB key.
The minimal FreeBSD distribution, Web interface, PHP scripts and documentation are based on M0n0wall.

Sounds like a perfect fit for the A2000!  Because the A2000 supports two 3.5″ hard drives and one CompactFlash card, I opted to install FreeNAS to the CF card. This allows me to use the two 3.5″ hard drives to the maximum, and gives me the ability to RAID (via software in FreeNAS) the two drives should I want to. The rest of this article is based around installing FreeNAS in this way, but if you want to install it in another configuration the directions here should still be helpful.

First off, I didn’t have any luck getting the FreeNAS live CD to boot using an external USB CD drive.  It would try to boot, but would die very early on in the process.  I was also unsuccessful getting Ubuntu 8.10 to boot all the way up (it died before getting to the desktop).  I didn’t spend too much time figuring out why, but my guess is that the Nano-ITX board included with the A2000 isn’t very well supported on these OS’s.  If anyone has any luck getting it to boot the live CD off of an external CD drive, go ahead an post in the comments.

In any event, I opted to remove the CompactFlash card and write the image directly using an external USB card reader.  Because I was doing this from my Linux desktop, this was a pretty straight-forward process that I will outline below.  However, if you’re using Windows, there’s a program the FreeNAS people suggest called physdiskwrite (part of the m0n0wall project) that sounds like it makes it even easier. I didn’t use that program so I can’t comment much about it, but it looks like it amounts to running it from the command line and specifying the image file you want to write and where you want to write it, much like the dd example below.

The first thing you’ll want to do is download the FreeNAS image from their Web site.  Like I mentioned before, I wasn’t able to get the live CD to boot, so go for the “embedded” image.  I grabbed the latest stable release (at the time of this writing that’s 0.686.4), but they have some recent betas and release candidate builds you could grab if you’re feeling adventurous.  Once you have the image downloaded, here’s a little tip: unzip it first.  This is one of the areas I got stuck on for a little while, because, even though the file you’ll download ends in .img, it’s actually gzipped.  If you know this, it’s easy enough to deal with, but leaving the .gz file extension off caused me an hour or so of tearing my hair out, downloading and re-downloading different images, and almost giving up before I finally found this blog post and was finally able to get a bootable FreeNAS install.  I have no idea why the FreeNAS guys chose to leave off the .gz extension; perhaps this is a sick game they like to play on the people trying to download and use their software. If it was mentioned anywhere that the disk image was zipped, I certainly couldn’t find it. Anyway, don’t make the same mistakes I did!

As an aside, if you suspect that a file isn’t exactly what it appears to be you can use the “file” command on a Linux system to try and get a little extra info.  For example:

david@W023:~/Desktop$ file FreeNAS-i386-embedded-0.686.4.3374.img
FreeNAS-i386-embedded-0.686.4.3374.img: gzip compressed data, was "image.bin", from Unix, last modified: Fri May 23 09:33:32 2008, max compression

You can see from the output that the file is actually gzipped.  If I’d known this before I started it would have saved me some time.  You learn something new everyday!

Anyway, so here’s what you need to do to get the disk image onto a hard drive or CompactFlash card using the Linux command line. First, you need to determine which device to write the disk image to.  You can find this in a couple of different ways, and it depends somewhat on the device you have attached (card reader, SATA hard drive, etc.) but the easiest way for me was to plug in the card reader I was using with the CF card inserted and then read the output of the dmesg command.  Here’s what that might look like:

david@W023:~$ dmesg | tail -n 20
[24559.663902] scsi 11:0:0:1: Direct-Access IC USB Storage-SMC 322E PQ: 0 ANSI: 0 CCS
[24559.666900] scsi 11:0:0:2: Direct-Access IC USB Storage-MMC 322E PQ: 0 ANSI: 0 CCS
[24559.670900] scsi 11:0:0:3: Direct-Access IC USB Storage-MSC 322E PQ: 0 ANSI: 0 CCS
[24559.728896] sd 11:0:0:0: [sdb] 1000944 512-byte hardware sectors (512 MB)
[24559.731947] sd 11:0:0:0: [sdb] Write Protect is off
[24559.731954] sd 11:0:0:0: [sdb] Mode Sense: 00 00 00 00
[24559.731958] sd 11:0:0:0: [sdb] Assuming drive cache: write through
[24559.748895] sd 11:0:0:0: [sdb] 1000944 512-byte hardware sectors (512 MB)
[24559.751877] sd 11:0:0:0: [sdb] Write Protect is off
[24559.751883] sd 11:0:0:0: [sdb] Mode Sense: 00 00 00 00
[24559.751887] sd 11:0:0:0: [sdb] Assuming drive cache: write through
[24559.752356] sdb: sdb1
[24559.759196] sd 11:0:0:0: [sdb] Attached SCSI removable disk
[24559.759504] sd 11:0:0:0: Attached scsi generic sg2 type 0
[24559.786019] sd 11:0:0:1: [sdc] Attached SCSI removable disk
[24559.786486] sd 11:0:0:1: Attached scsi generic sg3 type 0
[24559.793137] sd 11:0:0:2: [sdd] Attached SCSI removable disk
[24559.793522] sd 11:0:0:2: Attached scsi generic sg4 type 0
[24559.803079] sd 11:0:0:3: [sde] Attached SCSI removable disk
[24559.803455] sd 11:0:0:3: Attached scsi generic sg5 type

This is the output I got after plugging in the card reader.  Your output may look slightly different depending on the make and model of your card reader. What we’re looking for is where the CompactFlash is getting attached; if we carefully scan the output above, you’ll notice a line that contains “sdb: sdb1″.  In this case, the CF card I was using already had a partition on it, so that’s why we get the /dev/sdb1 instead of just /dev/sdb.  Another indicator is that most modern Linux distros will generally “pop up” and mount any newly-attached devices that have partitions on them.  If the CF card was not already formatted, you can still see that there is a bunch of information about sdb that isn’t there for the other devices.  If you REALLY want to check though you can try the following:

david@W023:~$ cd /sys/block
david@W023:/sys/block$ cat sda/size
156301488
david@W023:/sys/block$ cat sdb/size
1000944
david@W023:/sys/block$ cat sdc/size
0

Basically we’re using the handy Linux /sys virtual filesystem (read more about it here if you’re interested) to get some specific information about our block devices.  The big thing to notice is that sda and sdb have size, while sdc does not (for reference, sda is my main hard drive).  If you’re curious, the size is given in blocks. Because I know I only have one hard drive installed in my system, and no other removeable media plugged in via a USB port OR in the card reader itself, I know that sdb is the CF card.

If you have an “X-in-1″ card reader like I do, you’ll probably see a bunch of other drives detected when you plug it in, much like I did in the dmesg output above.  Using one (or all) of the processes outlined above you should be able to safely determine where the CF card is and disregard the others.

OK, now that we’ve determined the location of our CF card, we’ll want to cd to the directory where we downloaded the FreeNAS image from earlier. In my case it was the desktop.

david@W023:~$ cd ~/Desktop

Next we’ll do the bulk of the work. We’re going to use the dd command to write the embedded image to the CompactFlash card. Before we get to that, a small digression on dd…

When using dd, you want to be VERY CAREFUL. Always double-check and make sure the “out file” is what you expect; especially make sure it’s not another disk on your system that has valuable data on it or you could overwrite and lose that data. One way to do this is to use the “mount” command with no arguments, and then check to see if the “out file” you’re writing to is mounted anywhere:

david@W023:~/Desktop$ mount | grep sdb

If you see any output at all, check and verify that what’s mounted is what you want to overwrite (and unmount it before using the dd command). In my case there was no output, because the CompactFlash card wasn’t mounted anywhere. If what you see is something like this:

david@W023:~/Desktop$ mount | grep sda
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)

DO NOT USE THAT DEVICE. This is the disk that holds your root partition (indicated by “on /”), which I’m guessing you’re probably not interested in overwriting.

OK, one last warning:

DON’T COPY AND PASTE THE COMMAND BELOW UNLESS YOU’RE SURE YOUR CF CARD IS ATTACHED AS sdb!!!

OK, let’s write our image to the CF card. As noted above, the image is zipped, so we’ll need to it unzip first. We’ll do it the fancy way and unzip and write the image all at once. Here we go!

david@W023:~/Desktop$ gunzip -c FreeNAS-i386-embedded-0.686.4.3374.img | sudo dd of=/dev/sdb
53248+0 records in
53248+0 records out
27262976 bytes (27 MB) copied, 0.635942 s, 42.9 MB/s

An brief explanation of the command above for those interested: the “-c” flag tells gunzip to unzip the file and dump the output to stdout, leaving the original file zipped. We then pipe that output to dd (using the sudo command since I wasn’t logged in as root) and specify /dev/sdb as the “out file” with the “of=/dev/sdb” switch.

That’s it! If everything goes well, you’ll see output similar to that shown above, with information about how many records were read/written, etc. Since FreeNAS is really small (27MB according to the output above), this should take almost no time at all.

Now that you have the image written to the disk, you should be able to pop it back into the A2000. Make sure you have your boot priority set in the BIOS to boot from the CF card first and then fire up the machine.

If your boot priority settings are correct, you’ll eventually get to a nice graphical FreeNAS splash screen. Hit enter on that screen and you’ll get a menu, much like m0n0wall or pfSense if you’ve ever used them. You have options to set the administrator credentials for the Web interface, set up any networking interfaces, change the LAN IP address, drop to a shell, etc. By default FreeNAS detects the ethernet port fine and grabs 192.168.1.250 as an IP; if your LAN is on a different subnet, you’ll want to change that address from this menu. You can also change the administrator password, which is probably a good idea. By default, the username and password for a FreeNAS box will be “admin” and “freenas” respectively.

Once you set the address for the box (you can use the “Ping Host” option to test for connectivity) you’ll want to hop on another machine connected to the network and access the web interface by taking your browser to the IP address you set above. From there, you can set up the drives you want to use and how those are exposed via services (such as FTP, CIFS/Samba, etc.). I won’t go into too much detail here, because different people will most likely want to do different things, and the documentation (warning: pdf link) for setting up your drives is very good. However, the process will be something like the following:

  1. Go to the Disks -> Management section of the Web interface, and add your drives
  2. Go to the Disks -> Format section and format the drives you just added
  3. Go to Disks -> Mount Point and mount the partitions you just created
  4. Go to Services section and expose the drives however you see fit

That’s it!  It was very easy to set up a RAID 1 and expose the RAID as a Samba share on my local network.  You also have options for setting up FTP, Rsync, etc.  It couldn’t be easier.

I did run into a strange issue when I was first adding my drives where there were more drives listed as available to add then were actually installed in the machine.  However, I believe this was because one of the drives previously had Vista on it and wasn’t wiped clean before being installed into the A2000.  After a little messing around and pulling the drives and wiping them, this issue disappeared.  I would recommend wiping your drives clean of all data and partitions before installing them into the A2000 just to avoid any of these sorts of issues.

Like I said before, except for the zipped image and the extra drive issues I ran into, it was a snap setting up FreeNAS on the A2000.  If you’ve ever used m0n0wall or pfSense, you’ll feel right at home here with FreeNAS.  If you have any questions or issues, post them in the comments below, and I’ll do what I can to help.  Otherwise, enjoy!

This entry was posted in Technology and tagged , , , . Bookmark the permalink.

25 Responses to FreeNAS on the ARTiGO A2000

  1. Pingback: The VIA “Home Mini Vault” : Logic Supply Blog

  2. Jerry Yuan says:

    Please choice FreeNAS 0.69RC2 than haven’t any problem when booting.

  3. Sledge says:

    Sitting here waiting for my ARTiGO to arrive! I am planning on booting FreeNAS from CF card and will use this guide to get up and running:

    http://www.freenaskb.info/kb/?View=entry&EntryID=296

    Maybe this will be helpful for others.

    Cant wait! :)

  4. Daniel says:

    What transfer rates over Gigabit did you got?

  5. George Hartzell says:

    With the current version of FreeNAS (0.69) the SATA ports only run at UDMA33. The patch described in FreeBSD pr kern/121521 fixes the problem when running FreeBSD-STABLE, I haven’t yet figured out how to rebuild FreeNAS with it.

    I also had trouble getting the ethernet interface to run at 1000Mb speeds, but didn’t investigate it too much. 100Mb runs just fine.

    FreeNAS with the SlimNAS extension this box runs *circles* around my ReadyNas NV+ and makes SlimDevices/Logitech’s Squeezeboxen a joy to use.

  6. George Hartzell says:

    I’ve tested these two changes in a custom build of FreeNAS 0.69 and my drives are now recognized as SATA150. I’ve asked the FreeNAS folk to roll the change into their tree.

    *** sys/dev/ata/ata-pci.h.SAFE Sun Feb 22 21:17:55 2009
    — sys/dev/ata/ata-pci.h Sun Feb 22 21:19:34 2009
    ***************
    *** 379,384 ****
    — 379,385 —-
    #define ATA_VIA6410 0×31641106
    #define ATA_VIA6420 0×31491106
    #define ATA_VIA6421 0×32491106
    + #define ATA_VIACX700M2 0×53241106

    /* chipset setup related defines */
    #define AHCI 1
    *** sys/dev/ata/ata-chipset.c.SAFE Sun Feb 22 21:19:46 2009
    — sys/dev/ata/ata-chipset.c Sun Feb 22 21:53:37 2009
    ***************
    *** 5410,5415 ****
    — 5410,5416 —-
    { ATA_VIA8237A, 0×00, VIA133, 0×00, ATA_UDMA6, “8237A” },
    { ATA_VIA8237S, 0×00, VIA133, 0×00, ATA_UDMA6, “8237S” },
    { ATA_VIA8251, 0×00, VIA133, 0×00, ATA_UDMA6, “8251″ },
    + { ATA_VIACX700M2, 0×00, VIA133, 0×00, ATA_UDMA6, “CX700M2″ },
    { 0, 0, 0, 0, 0, 0 }};
    static struct ata_chip_id new_ids[] =
    {{ ATA_VIA6410, 0×00, 0, 0×00, ATA_UDMA6, “6410″ },
    ***************
    *** 5418,5423 ****
    — 5419,5425 —-
    { ATA_VIA8237A, 0×00, 7, 0×00, ATA_SA150, “8237A” },
    { ATA_VIA8237S, 0×00, 7, 0×00, ATA_SA150, “8237S” },
    { ATA_VIA8251, 0×00, 0, VIAAHCI, ATA_SA300, “8251″ },
    + { ATA_VIACX700M2, 0×00, 0, 0×00, ATA_SA300, “CX700M2″ },
    { 0, 0, 0, 0, 0, 0 }};

    if (pci_get_devid(dev) == ATA_VIA82C571) {

  7. david says:

    Thanks for the updates George!

  8. K Davis says:

    Does anyone know if there is a fix or patch for enabling the nic to run at gigabit speed under freenas?

  9. PreacherManX says:

    Yes there is. Working on getting the patch bundled with both FreeNAS, and FreeBSD.

  10. Pat Martini says:

    I have hear dabout many similar problems getting FreeNAS installed, and using it. It is apparently very poorly documented, and the use of non-standard file specifics (no .gz, for example), seem to purposely mislead the user. I don’t recommend this software as the design and application tends to follow the authors’ general attitude – poorly done.

  11. Martin says:

    Is the VIA VT6130 PCIe 10/100/1000 controller supported at this time? I’ve read reports saying that it’s 1) not recognized, or 2) not running at Gb speeds on FreeBSB/FreeNAS. However, I haven’t seen anyone firmly stating that support for the VT6130 has been added.

    PreacherManX: Any info on the patch you are mentioning above being included in FreeNAS 0.69.1 (Omnius)?

    Thanks!

  12. david says:

    Hi Martin,

    I’ve been working on a custom build of FreeNAS that includes support for Gigabit Ethernet and SATA150 on the A2000, which should be ready very soon. We’ll post the new image for download when it’s ready to go, so stay tuned.

  13. Martin says:

    David,

    I assume that build will also work with the VIA NSD7800 Barebone since it’s nearly the same hardware? Is it built on 0.69.1?

    Will you guys be selling the VIA NSD7800 too?

  14. david says:

    Hi Martin,

    I think you might be thinking of the VIA NSD7200. If so, from the information VIA has made available, our image should work, as the chipset is identical. I haven’t personally tested our image because we don’t have one here at Logic Supply. At this point we’re not sure if we’ll carry it, but it does look like it will take a CF card, so flashing our build should be the same as for the A2000.

    At this point we’re not sure if we’ll be carrying the NSD7200, but I can post here again if we decide to.

  15. b. webb says:

    Hi David,

    This is the device he’s asking about:

    http://www.via.com.tw/en/products/embedded/nsd7800/index.jsp

  16. david says:

    Hi Burr,
    If he was actually talking about the NSD7800, then our FreeNAS image could work, but we have not tested it. The Ethernet controller on the NSD7800 is the same as the A2000, but I know that (at least) the chipset is different. I assumed that since he mentioned the hardware being almost identical he was referring to the NSD7200 (we all know about assumptions, though).

    Anyway, if anyone puts our FreeNAS image on the NSD7800, let us know how it works out.

  17. Martin says:

    Burr & David,

    Yes, I was indeed asking about the barebone Burr linked to. Smart move Burr … to link to the product. ;) Thanks. Why didn’t I think of that? 8)

    I’ll likely be buying a NSD7800 … if I can find one. I’ll post back here if I can get FreeNAS to run on it.

    Thanks to both of you.

  18. Thomas Lotterer says:

    @George Hartzell
    I tried your patch on a VIA ARTiGO 2000 running FreeBSD 8.0-CURRENT and two WD15EADS HDDs. The good news is that atacontrol(8) now reports “SATA150″ while unpatched it reported “UDMA33″. However, the bad news is that it should report “SATA300″ and worse there is absolutely no performance difference – 38MB/sec writing to and 56MB/sec reading from a ZFS mirror – with and without patch. Seems there is more work to do in this area.

    @K Davis
    The FreeBSD 8.0-CURRENT vge(4) driver set to media “autoselect” reports “1000baseT full-duplex”. This did not work with FreeBSD 7.1. Should be inherited to FreeNAS soon.

  19. Martin says:

    I eventually did find the NSD7800 and bought one. It does have the same issues with the UDMA33 and the NIC at only 100MB/sec as pointed out. Since the DAAP bug fixes in 0.69.1 are more important to me, I’ll wait for the ATA and NIC fixes to be rolled up in upcoming FreeNAS updates.

  20. minos says:

    I’ve tested FreeNAS on NSD7800!

    Unfortunatily VIA plugged in a second SATA controller from Marvall and this is not supported – therefore you can only use the first 4 bays on the VIA controller with freeNAS.

    a patch would be great :).

    for more infos or testing request plz send me an email at stefan [dot] s [at] gmx [dot] at.

  21. Baron says:

    I’ve tried installation of both FreeNAS 0.7RC1 and
    FreeNAS 0.69.2 on NSD7800.

    Does not seem to properly recognize the VIA Velocity VT6130 Gigabit Ethernet Controller, and though I’m allowed to manually “Set LAN IP address”, there’s no way to advance with “Assign Interface”. Only “Auto” option is enabled, and though unplugging and plugging back, does not find link or is able to ping any IP on the network.

    (Martin, how did you manage to make it work?)

    It’s a real pity as FreeNAS would be the damn perfect OS for this box. I resist to install WHS as I distrust it’s filesystems, but after tryng OpenSolaris and Ubuntu Server (both working, but a lot of network issues :() I’m stuck with this box from VIA.

  22. Martin says:

    Baron,

    Sorry for the late reply. I just installed it and never had any problems. It just worked. Well, aside from the fact that I could only use 10/100. Also, the SATA controller for the lower four bays didn’t work, as minos pointed out above.

    I believe I used FreeNAS 0.69.1.

    I agree the NSD7800 is more or less the perfect hardware for FreeNAS.

    If you don’t like Windows and still can’t get FreeNAS to work, try using OpenFiler, which is based on Linux. It should work nicely too and probably won’t give you as many hardware headaches. ;)

  23. Martin says:

    Moderator(s):

    Could you add “auto-notify” when new posts are made? I don’t get updates when someone posts to a thread I’ve posted to. It’s a nice feature. I forget to go back and check.

    Please feel free to delete this post.

  24. Andrew says:

    Does anyone know, if the Artigo supports SATA300 with FreeNAS 0.7 Build 4919 Release?

    My SATA drives are still reporting SATA150!

  25. topstereo.it says:

    My partner and I stumbled over here coming from a different web page and thought I may as
    well check things out. I like what I see so now i am
    following you. Look forward to checking out your web page for a second time.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>