NAS based on Nexenta and ZFS

For some time now I have been flirting with the idea of getting myself a Network Attached Storage (NAS). I get excited about the idea of having all my important files and stuff on a single device that supports raid 1. I can then reinstall Ubuntu on my laptop as many times as I want without having to worry about moving data somewhere safe first. I will not have to give up my laptop to my wife because that is where we keep all our personal digital photos and videos and she really wants to send the latest snapshots of our daughter to her mother… NOW.

If you look at what is available on the market you can see that the cost of these devices are tremendous. The much cheaper alternative is to build something myself. I had a dual PIII 800MHz machine but I thought that was an over kill. I want this to consume the least possible amount of power and to run as cool as possible. When I found a old celeron machine at Uni I decided that I would put something together. I attached 3x 14GB IDE hard disks and a CD drive and had myself an ugly but functional machine.

I looked at FreeNAS which is based on monowall which in turn is a based on a minimal FreeBSD system. What is really cool about FreeNAS that it easily fits on a USB or CF disk and moves your machine towards being an appliance with all the benefits that include less heat and better reliability.

Being a bit paranoid I decided I would not accept anything less than ZFS for my data. I believe it is the only file system that detects silent data corruption. It also has a lot of hype surrounding it and I have being wanting to play around with it for a while. The current versions of FreeNAS do not have ZFS support, but when FreeBSD 7.0 comes out it will have native ZFS support. This means that FreeNAS will gain ZFS support at some stage. I, however do not want to wait.

Enter Nexenta, a distribution based on opensolaris with a GNU userland. I wasn’t completely at home, coming from a Linux background and I noticed that some of the command line tools support different command line options, but here is the best thing about Nexenta… It uses apt for its package management. I truly believe that apt is the best tool out there and is what drew me to Debian in the first place. It also has some nifty features like support for ZFS root file system and a tool called apt-clone that takes a ZFS snapshot of the system before major upgrades and allows you to revert if the upgrade goes wrong. All this without rebooting so no downtime. To summarize Nexenta is an interesting project and I will use it to build my NAS.

I installed Nexenta Alpha7 and created a zpool out of 2 of the disks changed the mount point to /mydata and shared it via NFS (ZFS has built in NFS/NFS4)

zpool create mydata mirror c0d1 c1d0
zfs set mountpoint=/mydata mydata
zfs set sharenfs=on mydata

After a while I realized that the Alpha7 version was not the latest and I wasn’t able to upgrade to the latest via apt! I installed Nexenta 1.0 RC3 and was able to import my old (mydata) ZFS pool. running zpool import will show all available pools that can be imported.

root@sun:~# zpool import
  pool: home
    id: 14253621109838762705
 state: ONLINE
status: The pool is formatted using an older on-disk version.
action: The pool can be imported using its name or numeric identifier, though
        some features will not be available without an explicit 'zpool upgrade'.
        home        ONLINE
          c0d0s1    ONLINE
  pool: mydata
    id: 7749473723610951541
 state: ONLINE
status: The pool is formatted using an older on-disk version.
action: The pool can be imported using its name or numeric identifier, though
        some features will not be available without an explicit 'zpool upgrade'.
        mydata      ONLINE
          mirror    ONLINE
            c0d1    ONLINE
            c1d0    ONLINE

I had to use -f (force) to import my previous pool

root@sun:~# zpool import mydata
cannot import 'mydata': pool may be in use from other system
use '-f' to import anyway
root@sun:~# zpool import -f mydata

I was then able to upgrade the ZFS pool

root@sun:~# zpool upgrade
This system is currently running ZFS pool version 10.
The following pools are out of date, and can be upgraded.  After being
upgraded, these pools will no longer be accessible by older software versions.
---  ------------
 3   mydata
Use 'zpool upgrade -v' for a list of available versions and their associated
root@sun:~# zpool upgrade mydata
This system is currently running ZFS pool version 10.
Successfully upgraded 'mydata' from version 3 to version 10

And finaly I get to see my pool up and running

root@sun:~# zpool list mydata
mydata  12.6G  9.30G  3.33G    73%  ONLINE  -
root@sun:~# zfs list mydata
mydata  9.30G  3.13G  9.30G  /mydata

I must say I am happy with my NAS. All I need is to get some large disks in there and I am good to go. I also look forward to get some experience with Nexenta and ZFS. I wonder if you can fit Nexenta onto a 128MB or 256MB CF card?

4 Responses to “NAS based on Nexenta and ZFS”

  1. Detro Says:

    I was sent here by a “common friend”, who lives in London. We share the same flat. 😉

    Anyway, you did something VERY INTERESTING: something I am looking forward to do. I just miss the money and any “old” computer (I left them all in Italy 🙁 ).


  2. Chris Says:

    I wonder if you can update your experiences with Nexenta so far. Nexenta 2.0CP is out now, and I have upgraded my Nexenta installation (actually a clean install). 2.0 is based on Ubuntu Hardy userland, 1.0 packages were supposed to have ported over, but the only apt reposiitory is hardy-unstable, adn a lot of packages are broken. This is very disappointing, I would have been better off staying with Nexenta 1.1. The ipfilter firewall is not enabled by default. Modify /etc/ipf/ipf.conf to taste adn enable the firewall with “svcadm enable ipfilter”. Also my Intel Pro/1000 GbE NIC is only running at 100Mbps, adn tweaking it with the Sun networking tool dladm has been fruitless, it refuses to switch to Gigabit speed. Other than that 2.0CP has been rock solid, I just use it as a Samba fileserver though.

  3. Charles Says:

    Thanks for the info!

  4. Ahmed Says:

    @Chris: I have being meaning to blog about this, but I switched to opensolaris about 6 months ago.

Leave a Reply