Skip to content

Getting serious about storage

Over the last few months I’ve been get­ting increas­ingly wor­ried about stor­age of my digital pho­tos. Slides occupy my very pro­fes­sional fil­ing sys­tem (I recently expan­ded into a second shoe­box!), and seem fairly well pro­tec­ted of everything short of a house­fire. But pho­tos from both of my digital bod­ies 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 con­sisted, basic­ally, of “try not to delete any­thing, ‘kay?”. Some­thing needed to be done.

I’ve dithered around a lot try­ing to avoid buy­ing a self-contained NAS appli­ance for a while. But this week­end 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 gig­abit eth­er­net, and runs Linux under the hood. I didn’t buy it as a hack toy — it’s still first and fore­most a stor­age device. But I still like to have a lot more flex­ib­il­ity than these sorts of things stick in the web-based man­age­ment inter­face. I picked up a couple of 750GB drives at the same time, and have been tool­ing around get­ting it up to speed since.

Best ref­er­ence point for inform­a­tion about hack­ing on these things is wiki.dns323.info and the com­pan­ion forum. To start with, get­ting a shell on the box is sur­pris­ingly easy. The last stage of the boot pro­cess, the box checks for a file named fun_plug in the root of its first volume and if it finds it, executes it. Cre­ate a volume, drop a script and a couple of bin­ar­ies in it, reboot, and you’ve got tel­net access.

There’s options to build volumes using LVM, RAID0 or RAID1, but select­ing the default options gives you two plain disks. I took that option, then repar­ti­tioned both drives, set up a manual RAID1 con­fig­ur­a­tion, and built a debian chroot envir­on­ment. There’s a couple of caveats here. The first is that the sys­tem adds a 512MB swap par­ti­tion to the start of each drive. This can be downs­ized, but it needs to be present oth­er­wise the sys­tem won’t mount any­thing else on that device and you don’t get any fun_plug love. Also, no mat­ter what else, the second par­ti­tion on the disk should remain ext2, because that’s what the firm­ware ker­nel can read, and you need that both to boot­strap fur­ther activ­it­ies, and to recover if things go pear­shaped. I res­ized these down to a single cyl­in­der each, and they cur­rently con­tain 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 ker­nel, and only really seems to sup­port ext2 (I’ve tried run­ning with xfs from a third-party mod­ule, but had noth­ing but prob­lems). Even­tu­ally I’d like to cross-compile a newer ker­nel and migrate the chroot from the cur­rent ext2 to a journ­aled fs, but for the time being it’ll do the trick.

I’m cur­rently rsyncing my desktop home dir­ect­ory over to it. Once that’s done I’m plan­ning on NFS-mounting $HOME, and most likely using rdiff-backup intern­ally to keep some ver­sioned backups. My Eee will very soon start rsyncing itself whenever it dis­cov­ers it’s joined my home network.

The box has a single USB port, but for some reason it’s ded­ic­ated to a print server. Pfft. Next month (already way over my hard­ware budget this month :-) ) I’ll be pick­ing up a third 750GB drive and a USB enclos­ure to dump the con­tents to every now and then (fol­low­ing the scheme that I usu­ally attrib­ute to jwz, but is really at least as old as mag­netic media). For bonus sexy points, add gphoto for suck­ing pic­tures out of every single one of my cam­eras that has a USB port, and me finally doing the grunt­work to get mon­it­or­ing alerts via twit­ter.

Yeah, OK, it’s totally a hack toy. But a use­ful one!