Hacking the D-Link DNS-321 NAS

November 26, 2008

For some reason I derive immense gratification from hacking cheap commodity consumer devices and making them do much more than they were originally designed to. Not that I can’t claim all that much credit (as I generally just apply readily available hacks that others have figured out), but still…

Some of my favorite past hacks include:

Original Xbox: I haven’t played games on it for years, but with XBMC on it, it remains a formidable media center.

Buffalo WHR-G54S: Essentially a cheap Linksys router clone, but by replacing the stock firmware it can support features typically present on much more expensive routers (such as sophisticated firewall or QoS functionality). I was running the powerful dd-wrt firmware on it for a while, but later switched to the Tomato firmware (also here), which has most of the same features but is a lot easier to use.

Tivo: Back when I bought my first 40GB Tivo, I hacked it to add a 120GB drive (for a fraction of the normal cost).

I was previously using an external USB drive attached to my Airport Extreme router, but decided that I wanted to upgrade to a less flakey and fully redundant (but still affordable) storage system for our home. The DNS-321 (or its older and slightly more featureful cousin, the DNS-323) fits the bill. Out of the box, it makes two SATA drives available over Gigabit ethernet via SMB. It supports both Raid 0 (striping) and Raid 1 (mirroring), but I’m using the latter for redundancy. With two 1TB hard drives, this gives me 1 TB of convenient, redundant, and reasonably fast storage, accessible from any laptop or desktop in our house (and our Xbox running XBMC). For solid performance as well as low power usage and noise, Western Digital Caviar GreenPower 1TB hard drives are highly recommended (and affordable, at around $110 each).

So all of this is already quite a decent package out of the box, but it can be extended much beyond these capabilities (and very easily, too!) All it takes is installing one of several hacks for the DNS-323 / DNS-321. The device turns out to be a full Linux computer (albeit with a small CPU and little RAM), and all it takes to enable all the Linux goodness is to copy a few files to the drive. It turns out that it looks for an executable file called fun_plug upon startup and executes this if it exists. Various hacks use this mechanism to deploy all kinds of applications, enable telnet or ssh, and more.

The simplest way to get started is to install the fonz fun_plug (also known as ffp). The instructions (or these alternative instructions) are pretty simple and straightforward to follow. After the installation, you are rewarded with telnet access to the device, but you will want to make sure to follow the rest of the instructions and set up a root password. I also recommend disabling telnet and enabling ssh instead. You now have a full Linux box at your disposal.

That’s pretty much where I’m at right now. I’m still trying to decide what to do with the device, but the possibilities are wide open. Many applications are either included with or available for ffp, including media apps like Mediatomb or Musicbrowser, server apps such as MySQL, Lighttpd, and PHP (allowing you to run a full LAMP stack!), P2P / Bittorrent clients like Transmission, rsync (so you can schedule offsite backups), subversion, and many more. Apps can be installed with funpkg, a simple package management tool.

There are also options beyond ffp, such as the apparently more powerful Optware package management system that can be installed on top of it. A huge number of packages are available for Opsware. This even includes Ruby and Git, so I’ll definitely have to play with this when I get a chance.