continua (next page) main index Well, I have now two Apple Macs and a Linux powered slate tablet. And I have an old Asus A1370D notebook (whose motherboard is working, but the CPU fan is broken), and a cheap wifi router and bluetooth USB key.

So I set up a "no moving parts" Linux server (using CompactFlash for storage). Then I nailed it on the wall of my bedroom, as you can see in the photo at the bottom of this page.

I also added my Arduino board to have even more flashing LEDs (you should have a look at that wall in the middle of night).

Shown in the photo:

Currently working for:


"No moving parts" Linux-powered single-board computer

This was the hardest part.

First, I had to unmount the motherboard, wiping out everything that was not needed (keyboard, screen, case, hard disk...) I only saved the CD/DVD drive to install Linux (after installation is not anymore needed): BIOS did not support PXE-booting, so I had no other easy chance to install Linux.


Substituting the hard disk with a cheap solid-state disk storage

I had to get a compactflash to IDE adapter (I got it for 5$ including shipping from China). And obviously a CompactFlash card of at least 1Gb (I salvaged a 2Gb one from a broken GPS navigator).

CompactFlash cards are memory devices whose 512-byte "sectors" degrade every time they get written. Generally speaking, if you write the same sector for more than ten thousands times (often a bit more), it will became unusable. This is not a problem for cameras (which rarely live more than 10,000 photos) and GPS navigators (or devices who just need a large read-only fanless storage).

But it is indeed a problem to us needing a "solid state disk" storage. Real SSDs, in fact, reorganize in real-time the sectors map, so that every "write" operation comes on a different sector. This guarantees that if a sector is written 10,000 times, it is only because all other sectors were previously written at least 9,999 times. Thus the lifespan of such a SSD is reasonable for normal PC usage (but not comparable to classic spinning hard disks... at least now, in 2008). And obviously it has its costs.

Then, a cheap (not too cheap) CompactFlash can be used as a "solid state disk" (with the right CF-IDE adapter) on a computer which rarely (or not at all) needs to write on disk.

I also partitioned it to use only needed space. A 100Mb partition for /var, some 900Mb for Linux root, and another unused 100+900 space. When the first two will fail, I will discard them and transfer everything on the other two, thus virtually doubling the lifetime of the compact flash card (as said above, you don't need 2Gb of Linux installation to have internet sharing and printer server).


Reducing Linux write-on-disk operations

Linux distributions are hard-disk specific. That is, lots of processes continuously need to write something on the disk. The most frequent reason is the "last access date": if you read (I repeat: read) from a file, then a few seconds later the kernel will issue a write in the directory containing it, to secure the timestamp of the last access operation (even if the file operation was a "read-only" one).

This happens by default on most of the common filesystems (if they are mounted as "read only" this obviously does not happen). If you want to disable it, then you need to mount the filesystems as "noatime" (no access time update). So I put a noatime flag in every entry of the /etc/fstab to get it done when booting (this is safe to do in all circumstances, even for desktop usage... but one day, you may need to know when that file was last "read" using the stat command: this is why the "noatime" is active by default; performance is practically unaffected because of large caching buffers).

But a number of other processes need to write: when you logout, the bash interpreter saves its .bash_history; time passes, and the crond and atd daemon need to update their last status, others need to write in /etc their updated configurations, logging comes in the /var subdirectories, swapping partitions with their own write operations, etc.

So I am experimenting this: having more and more partitions; one for root (I hope to convert it to read-only), one for /var (to host syslogs and file stuff, always read/write), and one for disk swapping. Plus extra partitions of the same block-count size, normally not even mounted, to use when the first partitions begin to show bad sectors.

My current /etc/fstab contents (yes, floppy was disabled; and /var was positioned in the first sectors of the compactflash card; and the backup partition is currently disabled; I also used reiserfs because it seems to me faster than ext3 filesystem):
/dev/hda1        /var             reiserfs    noatime          1   2
/dev/hda2        /                reiserfs    noatime          1   1
#/dev/hda3       /backup          reiserfs    noatime,ro       1   2
/dev/hda4        swap             swap        defaults         0   0
/dev/cdrom       /mnt/cdrom       auto        noauto,owner,ro  0   0
#/dev/fd0        /mnt/floppy      auto        noauto,owner     0   0
/tmp             /tmp             tmpfs       noatime          0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0

Notice the /tmp directory assigned to temporary file system (tmpfs): I can safely work in /tmp (for example getting packages from another computer using sftp and installing them using pkgtool).


What to install?

A "bare" Linux installation could require a very few megabytes of disk space, but needs careful tuning.

A server station does not need any fancy graphics, nor X-server and similar stuff.

A full server (internet and masquerading, printer server, DNS, ssh, etc) can work without problems in less than 128Mb RAM. I also reduced the video shared memory to 2Mb (minimum allowed by BIOS) instead of 16/32Mb, to reduce "disk" swapping.

I chose a quick and dirty installation, selecting a common distribution (OpenSuse 10.3 or Slackware 12) and getting a decent selection of packages.

OpenSuse 10.3 could not drive the CompactFlash because of the kernel using an old beta of the pata_sis (parallel ATA disk interface for SiS chipset) driver, even if it worked well on hard disks (to use the compactflash I had to select irqpoll Linux kernel parameter at boot, but this slowed down really much read/write operations). I cannot guarantee that other motherboards won't show the same problem as well.

So I switched to Slackware 12, which uses the old IDE/ATAPI disk interface (the one that was abandoned in favor of new pata/sata drivers). It went flawless, recognizing the CompactFlash as /dev/hda (as if it was a true hard disk).

I selected package series A-AP-D-L-N (applications, applications programs, development, libraries and network). No on-line documentation, no kernel source, no programs that I will never use. Only libraries and languages needed to the various daemons and servers.

Then I manually deselected lots of packages from D, L and N series. From D series, I only left Perl, Python and Ruby: Perl and Python are required by CUPS printer server, and Ruby is my favorite scripting language. The gcc development is not needed on a server...!

Libraries: deleted graphics-related stuff, and other useless things.

Network: deleted unused services such as Apache and virtual networking and so on (I do not actually need a full-fledged webserver on my home server; some lighttpd could work; no, better: a Ruby webrick one-line intelligent webserver with scripting is even lighter).

This way, I installed some 700-800Mb of packages (well, I didn't want to tune too much), which is my current installation setup. In the first time, when I erased also audio and CUPS stuff, I had it trimmed down to some 300Mb (and it could be trimmed even more). CUPS depends on some large packages (Ghostscript, Perl, Python...).



Temperature levels issue

After installation I verified that I could log on home server via network (a fixed IP address makes your life easy!) using ssh.

So I could detach the VGA monitor, the keyboard, and the CD/DVD reader.

Before nailing it on the wall, I had it a few days on my desk, to be definitely sure that it won't get on fire: without a CPU fan, that Pentium III CPU could get too hot...

So I configured the lm_sensors package. By calling sensors-detect (while root), I got the modprobe commands to have the sensors utility run. It suggested me to add these commands at boot:
modprobe i2c-sis630
modprobe adm1021
modprobe eeprom
/usr/bin/sensors -s
(these will work on all other SiS630-based Asus computers).

Running sensors utility from time to time, and watching processor loads (with w or cat /proc/loadavg or uptime commands), I found that under normal circumstances (and low load), processor temperature is normally between 53 and 62 degrees (Celsius scale). This is because all those daemons do not need continuous CPU time. The "heavy duty" comes when I print some pages (Ghostscript requires pretty CPU time), but it's only "some spikes" in the CPU usage graph table.

The original CPU fan began spinning when the processor reached 75C, stopping when the processor got lower than 65C. When the Sunon CPU fan broke, I found that the processor stopped working (some hardware safety switch inside) when the temperature became 105C (even if sensors suggests that the "upper limit" is 75C). I remember working with temperature as high as 88C (while the mainboard was still in the notebook) without problems. Anyway, having temperature levels as low as 55-60C under normal circumstances, is sufficient to convince me that is safe to nail it on the wall (leaving some 15mm space between the wall and the board for extra safety).


CUPS-related headaches

I have an old HP Laserjet 1100 printer, talking on a parallel port. Alas, my computers (two Apple Macs and a Fujitsu-Siemens slate tablet) do not have a parallel port. I didn't want to buy some parallel-to-USB adapter, for two reasons: first, the Laserjet comes with its own non-standard HP cable (from standard DB25 to "special" HP connector), thus I should search for some rare DB25printer-to-USB cable; second, the "home server" has a parallel DB25 port ready to use...

While OpenSuse allowed for different networking printer servers (like the lightweight lpd), Slackware 12 only came with CUPS.

I had to install links package (text-mode browser for Linux, not requiring X: luckily it comes with all major distributions) to configure CUPS on the home server. I invoked it with links http://localhost:631 only to go in Administration menu, enable "remote" administration, and then enter from another computer (with a graphical browser like Firefox) to configure.

Firefox 3 refused to connect at first, because saw the CUPS host was "self-certifying", so I had to add an exception certificate.

I configured the printer as a "PCL 4/5" capable (actually HP 1100 is a 600dpi A4-sized with PCL/5e-language and 2Mb RAM). CUPS makes it appear in the network as a generic Postscript printer. Postscript files get translated to PCL/5e by gs (ghostscript utility).

At first, it did not print even the test page. After some investigation, I found that it required some foomatic executable, which was only in the groff package of Slackware installation. I also found that Slackware did install the graphical version of /usr/bin/gs renaming to gs-no-x11 the text one, so I had to erase the first and rename to /usr/bin/gs the latter.

Installation from my Apple Powerbook was straightforward: sys preferences, add a printer, click OK (Mac OS X uses CUPS as well). But I had a lot of headaches trying to install from my Mac Mini, which installs it but shows a generic "Print Error" every time I try to print anything. Weird, eh? To date, I cannot yet print from that Mac Mini (anyway, currently this is not a problem to me). Trying with another user and with supervisor did not gave different results.



HSDPA modem

I got a cheap Brionvega N7010 cellphone (some notes here, sorry, in Italian only), featuring an HSDPA modem via USB serial port.

To use it, I simply need to modprobe the usbserial module specifying what device has the USB serial port (note that not all kernels provide the vendor and product parameters to usbserial module: you can verify it with modinfo usbserial command). After connecting the cellphone USB cable, I must issue this command:
modprobe usbserial vendor=0x05C6 product=0x6000

The internet connection script prints out, every second, the rx/tx values to let me check traffic usage limits:
echo ""

if [ ! -r /dev/ttyUSB0 ]
then
  echo USB port not found: please modprobe again usbserial module
  ls -al /dev/ttyUSB0
  rmmod usbserial
  echo ""
  exit 1
fi

date
echo ""

LANG="C" sensors
echo ""

TMPF=/tmp/ppp.$$

route

# --- setup /etc/resolv.conf using quick and safe DNS servers ---------------

echo nameserver 193.70.152.25  >/etc/resolv.conf
echo nameserver 193.70.192.25 >>/etc/resolv.conf


# --- internet sharing: scheduled 15 seconds later, after connection -------

(
sleep 15
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -t nat -L
echo 1 > /proc/sys/net/ipv4/ip_forward
) &


# --- traffic logger --------------------------------------------------------

(
sleep 5
while true
do
  ifconfig ppp0 &> $TMPF
  if [ $? -eq 0 ]
  then
    X=`grep RX $TMPF | grep -v packets`
    echo -e $X | tr "\n" "\r"
  fi
  sleep 1
done
) &


# --- pppd ------------------------------------------------------------------

/usr/sbin/pppd /dev/ttyUSB0 921600 crtscts nodetach defaultroute usepeerdns \
    lcp-echo-failure 10 lcp-echo-interval 86400 connect \
    '/usr/sbin/chat -t 6 -s -v "" ATZ OK ATDT*99***1# CONNECT \d\c'

# --- when pppd exits after a ctrl-C or carrier lost, kill background jobs --

sleep 2
killall bash
sensors


Wall-nailed home server

home page - send e-mail - continua (next page)