Linux : Sheevaplug as a perfect NAS

After having done a little research on arm based computer (see article), I found an used Sheevaplug for less than 40 euros (!)… So I decided to use it as a NAS. Below is the main steps I followed to install it : easier than installing a classical x86 debian.

Like I did on my previous x86 server, I use two 2To sata disks : one for main storage plugged on the eSata port, and another plugged on the usb2 port for mirroring (sync’ed every night with rsync then turned off for power saving and disk protection)

Preparing

The following site contains a simple and well made guide to get a debian Squeeze install image for the kirkwood architecture (the one used by the Sheevaplug):
http://www.cyrius.com/debian/kirkwood/sheevaplug/install.html

As I wanted to optimize SdCard partition (see article), I prepared the sdcard on my desktop (archlinux). After partitioning, I made a LVM partition the classical way before formating in ext4:

 

As I wanted to install the root partition on the SdCard, I could not use it as install media. So I put the install image (uImage) and the initrd image (uInitrd) on an usb pendrive (/boot will be on internal sheevaplug’s flash: /dev/mmcblk0p1).

Boot sheevaplug and follow the installer

I followed the aforementioned guide and I made the following choices during the debian install process:

  • do manual partition
  • choose not to format existing partition (just select mount point as I previously optimised and formated the SdCard)
  • ignore error about bad option on file system (due to no journaling) => answer no
  • answer no for swap too (not need for swap in my case)

The base system install begin, and all is automated…

Optimize system for flash drive (sdcard)

In order to optimize the whole system for flash drive (more speed and less write access) I made some custom changes to both /etc/fstab and /etc/rc.local.

On fstab I mainly added tmpfs partitions for frequently written directories as well as more secure mount options:

 

Then in /etc/rc.local I setup “deadline” scheduler which is better than the default one which is made for harddrive. Note That I don’t use the “noop” scheduler because “deadline” can be better as it group small accesses, which improve latency.

 

Finaly I made a little script based on my own shell library to sync /var/log and /var/backup to a non tmpfs partition in order to keep logs on a non-volatile support. I run this on a weekly basis throught /etc/cron.weekly.
This mecanism is safe enought for me as my sheevaplug is powered from a battery backed up source, so there is very few chance to loose log files (ok, the server could crash and I accept that)…

 

NAS softwares

After having finished the base system install and optimizations, I configured two main software for a NAS : Network Sharing and search engine.

Samba install

There is not a lot to say for samba installation as it is pretty straight forward using “apt-get”.
I got the best speed results (thought both wired and wireless connections) with the following adjustments in the configuration file (/etc/samba/smb.conf)

 

A search engine for hosted document

I used “regain” to index all my documents. It works more or less like google and is very usefull to find documents on the NAS (including mp3, as it indexes ID3 tags).

I got the server version on sourceforge and unzipped it in /opt. Then, I  followed the install instructions on http://regain.murfman.de/wiki/doku.php?id=installation:server (I chose to install it on /opt)

To run the web UI you need to install tomcat

 

Then change the memory allocated to the tomcat’s JVM (32M is enought for regain web interface) in /etc/default/tomcat6 :

 

Finaly I made a script to update document index every week  if any new file has been added on the NAS during the last 7 days (again, based on my own shell framework):

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.