23.5.10

VIA Epia Homeserver Project - Installing Linux

Upgrading the BIOS 

This is optional: I however believe that it is better be safe than sorry :) The latest BIOS for EN12000EG is V1.09 available for download in the Downloads tab. The bad news is that the BIOS flash tool demands DOS. Because of this, I briefly plugged a CD drive to the system and installed FreeDOS on the CF drive. I burned the flash tool and BIOS binary after this, and copied it to CF disk. Note that the latter is necessary as the flash tool does not run from read-only media such as a CD. It is also important to make sure that the motherboard would not be unplugged from the mains during the flashing process!

Preparing the install

If the BIOS update is not necessary, one can install the system without using a CD/DVD drive, only a usb stick is to be used.
As we anyhow build a server, we shall use Debian :)
There is a good howto on debian.org on installing from usb sticks. The main points are the following:
  • You need to download two disk images: One for making the usb stick bootable (using syslinux). This can be obtained here (only boot.img.gz is needed). The second one will be the actual installer, for which we use the netinst image meaning that most of the packages will be downloaded from the internet during install. Iso image is available here (choose i386). 
  •  The boot image needs to be extracted and written to the flash drive. The device needs to be at least 256MB in size. No matter if it is larger, because the resulting partition will be of this size. The operation can be done via dd, which is available for windows as well by simply issuing in the command line:
         dd if=boot.img of=flash_drive
    with flash_drive being /dev/sdX on linux and \\?\Device\HarddiskY\Partition0 on windows. Note that X=[a,b,c...] or Y=[1,2,3...] for the flash drive that needs to be written. It is important to double-check the actual path before destroying data on another device by mistake! For the windows version this can be done via dd --list which lists all available devices with description. If boot.img is in another directory, then its path needs to be changed as well.
  • Replug the flash drive and copy the netinst iso image to flash drive, preferably to the root directory. Note that the iso file should not be extracted, but simply copied, as the installer will mount the image itself.
The bootable flash drive is now ready, the only thing to do is to make sure that a wired internet connection is available so additional packages can be downloaded during install. The preferred way is to use an empty LAN port on a router and to use DHCP.

Booting from the flash drive

In principle this should be simple, yet I found it quite hard to make the motherboard boot from USB flash drive even after reading some earlier manuals on the topic. For me, the following steps worked with V1.09 BIOS:
  • Set the first boot device to be USB-ZIP in BIOS. 
  • Switch off the computer and unplug its mains. 
  • Remove all IDE or SATA hard disks, and USB keyboard and mice so that only the USB stick remains.
  • Replug the computer and switch it on.
  • At this point it will boot from the flash drive (most likely), but obviously there is nothing to install to :)
  • Switch off the computer and replug everything that is necessary.
  • Start install :)
So,  in a nutshell, it is necessary to have one power cycle with only the flash drive plugged in. The funny thing is that a mere reboot is not enough, one has to unplug and replug the power supply.

And finally, install

Mostly, one can go with the default options. As I used a 4GB CF card as /dev/hda, I formatted 3.75 GB to be the root filesystem (using ext3), and the rest to be swap. Note that it is indeed not recommended to use any flash drive for swapping, yet my experience is that for the intended kind of operation it is rather seldom used, but sometimes it can be useful. As CF contains internal wear leveling algorithm, mainline filesystems, such as ext3 can be used for the system. The only thing that has to be taken care of  is to switch off the atime attribute using noatime mount option (this can be done during partitioning). The default atime causes write to the hard drive for each read operation as it updates the last access time for the files. This is useful for certain applications such as backup and mailing tools, but causes a great deal of unnecessary writing operation.
The rest goes quite straightforward, I chose to install only the option Standard System in order to customize packages later on.

Good-to-have packages

Apart from the default packages that come with the default install, the following ones might be useful as well:
  • bzip2, less, mc, ssh-server for convenient use :)
  •  make, gcc, libncurses5-devautomake, psmisc to make kernel compiling and installing source packages possible;
  • ddclient to make the box accessible via its domain name with a dyndns.com account;
  • iptables for firewalling and/or routing: this is installed by default, although I prefer to have the latest stable version from http://www.netfilter.org/
  • lm-sensors to read on-board temperature and voltage sensor outputs. It was not straightforward to make it work, so I will write about the details in a separate post.
  •  samba server from samba.org. Here again make sense to compile from source and setup separately as the version in the debian stable repository is quite old.
  • Enhanced ctorrent a nice command-line based torrent client, might be useful as well. Obtained from here
Packages in the first three bulletpoints can simply be optained by apt-get install, the rest however are downloaded from other sources and might need some hacking to make them work.



20.5.10

VIA Epia Homeserver Project - Ingredients

I recently decided to put together a small linux box to be a media- and fileserver and router and to be a good playground as well :) My goal is to have a box which is small, quiet and has a low power consumption and not to be forgotten, cheap. From now on, I will write about how to put it together from the bare scratch.
Let's see the ingredients for this project:

Motherboard:

I chose VIA Epia series because of its good availability and because of having a very good power consumption figure. Note that if you plan to play HD movies directly then this is most likely not your platform (better pick something based on Intel's Atom), yet for a router / file server box it is a good trade-off. For a router we need two physical ethernet interface and for high capacity storage SATA connectors. This is what one has to bear in mind when picking the actual device.
I chose EN12000EG because..., well it was a good deal on ebay :) Yet, it has two onboard SATA connectors, and one can add an additional ethernet interface via its PCI slot which is what I exactly did by putting a RTL8169-based gigabit ethernet card in. The motherboard is based on a VIA Eden processor meaning that it is completely fanless which is an important point as well.
Regarding to the memory: One 256MB 533MHz DDR2 one would do it, as we will not need anything that consumes a great deal of system memory. It has to be noted however that the onboard VGA takes 64MB out of the value above.
It is a good thing that the motherboard is well documented, all documentation is available at VIA.

System hard disk:

For this purpose, I will use a 4GB CF card, which is enough for the bare system. To hook this up to the main board, a CF to IDE converter is necessary, which is in the 1 USD range on ebay. Note that it is a good idea to buy a dual CF converter (so that one will be the master and one will be the slave device) for optional temporary storage for for instance torrent, as the main hard disk can be still turned off and does not consume any power. 

Main hard disk:

This will be a Samsung EcoGreen drive as we do not need really fast random seek, rather a low power and reasonable sized storage. Anyhow, the box should be designed so that it turns off the hard drive whenever possible.

Case:

For some reason, cases designed for mini-ITX motherboards are rather expensive. Because of this, I choose a mini-ATX /ITX case, Codegen's MX-31-A2. The only drawback is that the built-in power supply is designed to be capable of 300W output so that it is expected to have very low efficiency for low power systems. This is to be measured later so that I can decide whether it is necessary to replace it.