This tutorial tries to show you how to setup a wonderful quiet fanless system.
I’ve bought a LEX NEO, a terribly nice Mini-ITX fanless barebone which includes an onboard bootable CF-card slot.
Thomas Bocek (nope.ch) helped me out with the following configuration.
The idea was:
- The harddisk should only run when used
- The whole system should be stored on a CF-card
- We don’t want to stress our CF-card. Directories with a lot of access like /var/log should be run in RAM
We decided to install Debian Linux by USB-install, using a USB-stick instead of running some PXE network install which seems to be far more complicated.
Here’s a short HOWTO (for more detailed instructions, please check Debian USB memory stick booting:
Download boot.img.gz (7.9 MB). Also, download the official netinst image (108 MB). If you can’t find it, check http://www.debian.org/CD/netinst/ and download the stable i386 version.
Now, prepare the USB-stick:
1 2 3 4 5 |
$> dd if=boot.img of=/dev/sda $> mount -t vfat /dev/sda /mnt/ $> cp debian-31r0a-i386-netinst.iso /mnt/ |
Boot from your USB-stick and install Debian Linux on your CF-card. If it won’t recognize your CF-card, you might want to disable DMA („ide=nodma“ as boot parameter). My CF-card, a SanDisk Ultra II 1GB, did not support DMA.
As soon as your system is set up, configure it to run directories with a lot of write-access completely in RAM.
Let’s create /sbin/preinit:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#!/bin/bash echo "creating tmpfs in /var/log" mount -n -t tmpfs tmpfs /var/log echo "copy /var/log" cp -a /var/log_persistent/* /var/log echo "set dma on for hdd" hdparm -d1 /dev/hdd hdparm -B0 -S18 /dev/hdd echo "done, resume normal operations..." exec /sbin/init |
This will copy all data from /var/log_persistant to /var/log which is located in RAM as tmpfs on boot-up. Also, it sets the harddrive’s APM to extremely aggressive (-B0) and standby/spindown timeout to 1:30 minutes (-S18).
Make sure, this runs before the default init.d scripts. We managed this by specifying the init parameter in GRUB, /boot/grub/menu.lst:
1 2 3 4 5 6 7 8 |
title Debian GNU/Linux, kernel 2.6.8-2-386 root (hd0,0) kernel /boot/vmlinuz-2.6.8-2-386 root=/dev/hdc1 ro init=/sbin/preinit ide=nodma initrd /boot/initrd.img-2.6.8-2-386 savedefault boot |
Next, set up /etc/fstab:
1 2 3 4 5 6 7 8 9 |
proc /proc proc defaults 0 0 /dev/hdc1 / ext2 defaults,errors=remount-ro 0 1 /dev/hdd1 /myharddisk ext3 defaults,errors=remount-ro 0 1 tmpfs /var/run tmpfs defaults 0 0 tmpfs /var/lock tmpfs defaults 0 0 tmpfs /var/log tmpfs defaults 0 0 tmpfs /tmp tmpfs defaults 0 0 |
/dev/hdc represents the CF-card on Secondary Master, /dev/hdd is the harddisk on Secondary Slave.
As you see, we’re now running the following directories in RAM:
/var/log, /var/run, /var/lock, /var/log, /tmp
All we need to do now, is synchronizing back the /var/log data to our CF-card every hour and on a shutdown
/etc/cron.hourly/backup-var:
1 2 3 4 |
#!/bin/bash rsync -ax --delete --temp-dir=/tmp /var/log/* /var/log_persistent |
Create /etc/init.d/commit:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#!/bin/sh case "$1" in start) echo -n "n/a" echo "." ;; stop) echo -n "Comitting changes and backup" /etc/cron.hourly/backup-var echo "." ;; restart) echo -n "n/a" echo "." ;; reload|force-reload) echo -n "n/a" echo "." ;; *) echo "Usage: /etc/init.d/commit start|stop|restart|reload|force-reload" exit 1 ;; esac exit 0 |
Add the commit script to all necessary runlevels:
1 2 3 4 |
$> cd /etc/init.d $> update-rc.d commit defaults |
That’s it! Enjoy your slick silent baby!
Jun 28, 2007 - 05:19 PM
Hello,
Note that with debian etch, you can install the flashybrid package which automatically does more or less the same thing.
Marc
Jan 12, 2008 - 03:18 AM
Nice! this instructions works very well to me. Ubuntu Server 7.10, Thanks.
Only the chmod +x commands are not in the text.
Feb 27, 2008 - 12:02 AM
Add the mount option „noatime“ to your grub/menu.lst to avoid updating the access time. This is something you really want to do 🙂
Regards!
Dez 17, 2008 - 10:38 PM
I am trying to install Monowall or Pfsense firewall on a Lex Light PC but it does not have CF card, I have only one 20GB HDD.
How can I do it? Because the disk is on Secondary Mater.