Last Change: 2007 Mai 10 Author: Johannes Ranke
As of November 2005, our old server was a little outdated with its 100 MHz Pentium Classic CPU and its 48 MB RAM... Looking for a cheap alternative, a company nearby proposed the following:
So after some more surfing I decided to install to an old style parallel ATA IDE disk, install a kernel supporting the SiS SATA hardware, set up the raid 1 I wanted to use and a logical volume management (LVM) on top of it, copy over the system and make it bootable. I got there except for the LVM - I really had a hard time configuring my bootloaders grub and lilo to do what I wanted...
I found out quite late that it is obviously not possible to have the /boot partition controlled by LVM. Of course, if you think about it, it makes a lot of sense....
Once I had a system installed on a traditional (PATA) IDE disk using the amd64 netinstall image for sarge, I got the sources for the latest kernel (220.127.116.11) from www.kernel.org and compiled the sata_sis driver into the kernel in order to be able to boot from it later. If you don't want to or don't have the experience to build a new kernel, there is the possibility to add a source for debian unstable in your /etc/apt/sources.list and install a binary kernel image by
apt-get install linux-image-2.6.14-amd64-k8
If you don't work with apt preferences, this will result in the upgrade of libc6 and some other packages. I didn't want that, since I wanted a real debian sarge installation, so this was one of the reasons I built a kernel with the sources from kernel.org.
If you do the same, be sure to compile all modules required to boot from the disk into the kernel, if you do not want to create and use an initrd.
The new kernel with sata_sis support found the two SATA disks and named them /dev/sda and /dev/sdb. With fdisk, I created the following partitions on /dev/sda:
Device Boot Start End Blocks Id System /dev/sda1 * 1 25 200781 fd Linux raid autodetect /dev/sda2 26 148 987997+ 82 Linux swap / Solaris /dev/sda3 149 9729 76959382+ fd Linux raid autodetectand formatted them with ext3 (mkfs.ext3) and created the swap partition with mkswap. I first set the type of all these partitions to Linux, because at my first attempts I couldn't get the system to boot from the SATA disks at all. You can skip this and immediately set up the raid devices with mdadm and continue with the copying of the system to them, if you have faith. Remember that the raid support has to be in the kernel or in the initrd in order to be able to have root on RAID.
So in the end, I copied everything from the PATA disk to the single disk /dev/sda by hand. But first, it is smart to install grub into /dev/sda. Within the BIOS, the hard disk which is taken as the first harddisk to boot from can be configured. I saw this rather late at night...
The copying (copy directly to raid after setting it up and mounting it to /mnt is faster).
cd / mount /dev/sda3 /mnt cp -a bin cdrom dev etc initrd home lib lib64 media opt root sbin srv tmp usr var /mnt(everything under / except for boot, home, lost+found, mnt, proc, sys). Then the mount points for the virtual file systems /proc and /sys and for /boot
mkdir /mnt/proc; mkdir /mnt/sys; mkdir /mnt/boot mount /dev/sda1 /mnt/boot cp -a /boot/* /mnt/bootAt this point (with these file systems mounted you could also run lilo -r /mnt if you set up /mnt/etc/lilo.conf correctly).
I created two RAID 1 devices (do this before copying as a shortcut):
mdadm --create --level=1 --raid-devices=2 /dev/md0 /dev/sda1 /dev/sdb1 mdadm --create --level=1 --raid-devices=2 /dev/md1 /dev/sda3 /dev/sdb3and waited for it to sync completely (about 20 min). If the raid support is in the kernel, the /etc/mdadm/mdadm.conf file is not needed, because the kernel reads the persistent superblocks on /dev/md0 and /dev/md1 that contain the raid setup information.
Well, in reality, after I had the single disk installation on SATA running, I just followed the excellent howto Migrating To RAID1 Mirror on Sarge
The remaining tasks are the setup of /etc/fstab
vim /mnt/etc/fstabwith the contents
#and grub, the latter by editing the device.map to match the order that you will give the harddisks in the BIOS (I suggest to match /dev/sda with(hd0) and /dev/sdb with (hd1)) and editing menu.list to contain something like
proc /proc proc defaults 0 0 /dev/md0 /boot ext3 defaults 0 2 /dev/sda2 none swap sw,pri=1 0 0 /dev/sdb2 none swap sw,pri=1 0 0 /dev/md1 / ext3 defaults,errors=remount-ro 0 1 /dev/hda /media/cdrom0 iso9660 ro,user,noauto 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
title Debian GNU/Linux, kernel 18.104.22.168-chem root (hd0,0) kernel /vmlinuz-22.214.171.124-chem root=/dev/md1 md=1,/dev/sda3,/dev/sdb3 ro savedefault boot title Debian GNU/Linux, kernel 126.96.36.199-chem (RAID recovery mode) root (hd1,0) kernel /vmlinuz-188.8.131.52-chem root=/dev/md1 md=1,/dev/sdb3 ro single
Don't forget to watch /proc/mdstat to see if the devices are still syncing before rebooting! Congratulations if you got this working!
I am sorry if this is not a real howto, but there is some excellent material on the web covering this, with the single most valuable document for me being once more the howto Migrating To RAID1 Mirror on Sarge. I mainly wrote this to document that the K8S-MX does work under Linux (except for the onboard LAN). In several forums people have stated otherwise, before the kernel support for the SIS 182 in sata_sis, and it still is not for beginners, I'd say. But to have a fast RAID file and database server for just 350 EUR is quite rewarding, I think.