In this post, I would like to present my custom, cheap-ass NAS-like device. It is an embedded Linux device running OpenWRT with a bunch of (spare) hard disk attached to it through IDE/SATA-USB convertors. The device exposes the disk to my internal network through Samba and remotefs.
The base of the project is a NS-K330 I bought from DealExtreme already quite some time ago. It features a CNS2132/str8132/FA526 (it depends on who you ask) ARMv4 core with Ethernet and two USB 2.0 ports. I didn't like the idea of having the disk(s) running continuously, so I wanted to make something with an on-demand activation. The entire contraption is powered by an old ATX-PSU and the disks can be activated from across the network.
Hardware
In the first picture, on the right, you can see the custom-made male 24pin power supply connector: a bunch of nails fixed with hot glue and some wires attached to it. The NS-K330 board is connected to the +5V standby power pin, so if the PSU is connected to the grid, the device runs. The yellow wire is connected to PS_ON: an ATX power supply is activated by pulling that pin to ground. The NS-K330 board has 4 leds that can be controlled from software. In hardware, this is also done by connecting something to ground. By connecting the yellow wire to the the cathode pin of one of the leds, the PSU can be started by triggering that led. The hard drives are powered through the molex connectors of the PSU, which means they only run when the led is lit.
The PSU was recovered from an old Dell PC. The pin-out of the connector, I discovered, is different from a standard ATX power plug. Wtf, Dell? The board is attached to the back plate of an old PC case. I also recycled an old case fan (or perhaps it was a PSU fan) to create a bit of airflow. The extra heatsink on the CPU (a quarter of a Pentium heatsink) hopefully reduces the temperature a bit.
The third picture shows a test setup with one disk and a USB flash drive. I'm still waiting for the USB hubs I ordered from DealExtreme. The idea is that they will also be powered by the PSU (I just noticed there is no port for external power, damn! Ah well, some more DIY I guess), which means that the IDE-USB convertors would also be powered down when not in use.
The default firmware was at first replaced with snake-os, a environment developed for devices based on this chip, but now it runs the cns21xx flavour of OpenWRT backfire. This port is still work in progress (although it works just fine) and has to be built from source. OpenWRT contains a package called mountd, that uses AutoFS to mount and umount attached volumes on demand. I did modify the code a bit: a device is now mounted on a directory named after its serial instead of the block name (050-chassnas.patch), and the serial is computed differently (040-serial.patch).
For now, the hard drives can be activated from on the device itself (it runs a Dropbear SSH server, included in OpenWRT) and by port-knocking on port 5002 (that's remotefs + 1). That last bit was surprisingly easy to set up: there is an iptables LED target to trigger leds on network events. Niceee.
Later, I will try to integrate the activation (and perhaps deactivation) into mountd. In a way, the patches above are already working in that direction.