Over the last few months I’ve been getting increasingly worried about storage of my digital photos. Slides occupy my very professional filing system (I recently expanded into a second shoebox!), and seem fairly well protected of everything short of a housefire. But photos from both of my digital bodies were just being sucked out onto the slow and heavily-burdened single spindle that powers my fairly slow and heavily-burdened desktop PC. The backup scheme consisted, basically, of “try not to delete anything, ‘kay?”. Something needed to be done.
I’ve dithered around a lot trying to avoid buying a self-contained NAS appliance for a while. But this weekend I finally went out and picked up a D-Link DNS-323. The D-Link seems to get some of the best reviews in that price range, comes with two SATA bays and gigabit ethernet, and runs Linux under the hood. I didn’t buy it as a hack toy — it’s still first and foremost a storage device. But I still like to have a lot more flexibility than these sorts of things stick in the web-based management interface. I picked up a couple of 750GB drives at the same time, and have been tooling around getting it up to speed since.
Best reference point for information about hacking on these things is wiki.dns323.info and the companion forum. To start with, getting a shell on the box is surprisingly easy. The last stage of the boot process, the box checks for a file named fun_plug in the root of its first volume and if it finds it, executes it. Create a volume, drop a script and a couple of binaries in it, reboot, and you’ve got telnet access.
There’s options to build volumes using LVM, RAID0 or RAID1, but selecting the default options gives you two plain disks. I took that option, then repartitioned both drives, set up a manual RAID1 configuration, and built a debian chroot environment. There’s a couple of caveats here. The first is that the system adds a 512MB swap partition to the start of each drive. This can be downsized, but it needs to be present otherwise the system won’t mount anything else on that device and you don’t get any fun_plug love. Also, no matter what else, the second partition on the disk should remain ext2, because that’s what the firmware kernel can read, and you need that both to bootstrap further activities, and to recover if things go pearshaped. I resized these down to a single cylinder each, and they currently contain a fun_plug and scripts to build RAID arrays and chroot in to the new environment.
D-Link ship the device with a 2.6.6 kernel, and only really seems to support ext2 (I’ve tried running with xfs from a third-party module, but had nothing but problems). Eventually I’d like to cross-compile a newer kernel and migrate the chroot from the current ext2 to a journaled fs, but for the time being it’ll do the trick.
I’m currently rsyncing my desktop home directory over to it. Once that’s done I’m planning on NFS-mounting $HOME, and most likely using rdiff-backup internally to keep some versioned backups. My Eee will very soon start rsyncing itself whenever it discovers it’s joined my home network.
The box has a single USB port, but for some reason it’s dedicated to a print server. Pfft. Next month (already way over my hardware budget this month :-) ) I’ll be picking up a third 750GB drive and a USB enclosure to dump the contents to every now and then (following the scheme that I usually attribute to jwz, but is really at least as old as magnetic media). For bonus sexy points, add gphoto for sucking pictures out of every single one of my cameras that has a USB port, and me finally doing the gruntwork to get monitoring alerts via twitter.
Yeah, OK, it’s totally a hack toy. But a useful one!