Some time ago I bought a little Linux device at DealExtreme. The specs are:
|USB||2 ports (1 port & 1 SD card controller)|
|Connectivity||Ethernet 100Mbps RJ-45|
The little thing is based on NS-K330 NAS board and it just costs 30 bucks. It gets very hot, so I started with some mods like adding some heat sinks and I finished creating a little server. First of all I added some heat sinks bought at DX's too. After that I designed a server box to create a little backup server. The hardware uses two 2.5'' HDDs from old laptops, the NAS board and two USB-to-IDE adapters bought at ebay. I also added a USB hub and I expect to add external ports or more hardware in the future. All the stuff is packed in a customized box.
Here the pieces, the board, the IDE adapters, some boxes, HDDs, ...
Started glueing some pieces toghether. The board its mounted on the little metallic box which contains the USB HUB and wiring.
The USB hub si connected to the free port on the board. I glued it all inside the box.
Some functional tests. The chinese stuff usually doesn't like color codes, so I had to reverse USB data wires some times
After removing the casing I soldered wires directly to the adapter. I removed the 3.5'' connector by desoldering it. Now the HDDs fit in the box.
This is more or less the hardware assembled. It's neater than I thought.
The HDDs are tied toghether using two metal pieces (I think they are 3.5'' to 5.25'' adapters). Everything fits perfectly well and there's some space remaining (which I'll use to add a fan). I added a couple of holes for the DC and RJ-45 connectors.
At first I used snakeos, a Linux distro built specifically for the hardware. It's quite good and it contains the most needed tools: fsck, ftp, samba and a web UI. My idea was to use the drives in a RAID array (mirroring) but I run into many problems with the snakeos kernel, it failed building the array and hung at device mounting. So I looked at the openwrt port for the arch, which is available in the trunk repository. I downloaded the sources and built the kernel and packages needed for my customized distro. The image contains USB and RAID drivers and the most common tools. OpenWRT is way more stable, I guess it's the 3.3 kernel (compared to the ooold 2.6 used by snakeos). In order to enable the port its necessary to edit the Makefile for cns21xx arch and remove the work "broken" from feature list.
The flashing procedure was tricky and I bricked my device several times. It was all my fault though. The problem is that snakeos is using a different partition scheme, which only has 960KB for the kernel instead of the 1024KB which openwrt has. So at flashing one should flash the kernel at the same offset but the root partition should be flashed at the correct offset. It is also recommened to erase the data after the root partition, as openwrt scans it at boot time and creates n overlay partition to store changes on the filesystem. This is a little tricky because you can lose all your overlay by flashing the rootfs. In order to rescue from a bad reflashing (if you are smart enough not to overwrite the UBoot bootloader) just attach a serial cable to the connectors in the board. Be careful, it's a TTL (5V) serial port, handle with care. It allows you to stop booting and launching a kernel image. The steps are:
Break the boot process by pressing a key. Set IP addresses: "setenv ipaddr *deviceip*", "setenv serverip *computerip*", "tftpboot 0x1000000 ramfsfilename" and then "go 0x1000000". I don't know why it's using address 0x1000000. I guess it's prossible to locate the kernel at any place, because it deals witth vritual memory, but I can't seem to find any explanation about UBoot. Is that a physical address? What is the memory mapping? Anyway, when the kernel with ramfs boots you can use ssh to copy the kernel and rootfs and flash the device. Nice right?
The final setup uses an 80GB RAID-1 partition (one HDD is 80GB while the other is 160GB) and another 80GB non-raid partition. This way I can secure important stuff in the RAID partition while using the other partition to store non-critical data. The raid is quite fast (8MB/s for reading and about 4MB/s for writing) but I had to replace the USB hub because it was a dodgy full-speed chinese hub... OpenWRT is very nice, it does almost everything automatically: mounts the RAID, the partitions and syncs the two drives if they get desynced (using bitmaps). I added a 2GB SD card which is fast (almost 10MB/s) for swap usage.
All this stuff with some ssh certificates, dynamic DNS and rsync will become an excellent backup server for home and office usage. I'm planning to use it to backup important data on all my computers. It's not a huge space, but I'll do.
I encourage you to build your own image. OpenWRT is really easy to build. It's just slow, but easy.
Kernel partitionand RootFS partition, squashfs and with jffs2 overlay. RAM image, really helpful to boot in case of rescue. I think it has USB disabled, it's not compiled with the same config as the above (that's why it's smaller than the 2.6MB expected). HERE is the new ramfs, not tested though.
Just for reference.
I set up a package repository for cns21xx in here:
http://openwrt.davidgf.net/snapshots/trunk/cns21xx/packages/but unfortunately it's deprecated since I'm not using this anymore.
Edit /etc/opkg.conf to change the URL of the repository