Thomas Horsten's Linux Page

Here you'll find various Linux related bits and pieces.

What's on this page

I've just started work on a new architecture for BIOS-RAID drivers in Linux 2.6. Right now I am trying to find the cleanest way to implement this support. My main criterion is that I want autodetection to work, so you can mount your RAID as a root device without using an initial RAM-disk. If you are interested in helping out with this effort, please join the mailing list here.

After some discussion on the LKML, it's become clear that autodetection in the kernel is not desirable for 2.6. The trend is to move all things that can be moved out of the kernel and into the new "initramfs" which is basically an early userspace without a real file system etc. So my approach will be to create a binary "ataraid-detect", which reads the RAID superblocks and uses the device mapper to create the Medley devices. There will still be some cleaning up to do, like removing the invalid partitions from the "native" disk, this will probably require a new hook in the kernel.

On this page, you'll find my Kernel patches, the most popular being my my 2.4 driver for Medley RAID, and other things I've written for Linux. At the moment it's all not very well organised, I'll hopefully gett around to work some on my web page in the near future.

Kernel Patches

Athlon compile options

I wrote a patch to make it possible to choose specific Athlon models when building the Linux kernel. It doesn't seem to make much difference with the current GCC, but I still like to have it.

Get it for 2.4.xx or 2.5.xx.

Medley Software RAID (Silicon Image 3112 and others)


Mailing List / Support

Please visit the mailing list page and browse the archive for common support questions and answers.

An important note about support: Over the last 6-8 months I have answered support questions sent to my main mailbox. Reviewing the questions and answers, it's apparent that I've done quite a lot of repeating myself, and with the availability of the mailing list that should not be necessary. So from now on, I will no longer answer support mail that is not sent to the mailing list (you don't have to be subscribed, I'll do a "reply-to-all" so you will get my response regardless). That way, there will be an archive of the questions and answers that others can see so I won't have to answer the same questions repeatedly. Thanks in advance for your understanding. I still welcome success statements (stating hardware info and kernel version) in my normal mailbox, if you don't require a response.

Notice that the public list archive removes anything that looks like an email address from the posts, so you don't need to worry about your address being harvested by spammers from there.

Notice for Linux 2.6 users: This driver is not for you. You need to use raiddetect instead. See the download section for a link.



I've written a driver for the Medley software RAID used by Silicon Image 3112 SATA RAID controller and some CMD controllers like the RAID controllers based on the CMD680 chip (680R).

Medley is a BIOS-assisted software RAID (ie., the BIOS has a built-in driver so it can easily boot from the drive). Any 32-bit operating system (ie., anything other than MS-DOS), needs its own driver that basically duplicates that functionality. So the main advantage of using this RAID type is not speed or performance (in this respect it is the same as any other software RAID), but that it can be used under multiple operating systems. If you are not going to dualboot Windows and Linux on the same machine, you are better off using Linux's MD software RAID, David Dollar has a HOWTO on that subject.

This driver conforms to the Medley specifcations, so it should work with all controllers that use this software RAID (unlike the "Silicon Image Medley" driver already in the kernel, which does not work in many configurations.

You need to apply it to a 2.4.2X kernel. Please send me feedback at thomas at since this is a new driver, if you get it working (or not), please send me a brief email describing your system! I'll happy to try to help with any problems.

Notice: This driver currently only works for RAID0 (striped) RAID sets. If you are using mirroring (RAID1 or RAID0+1), this will not work for you. If you want to help implement the other modes, contact me.

Bootloaders and Medley

GRUB doesn't seem to be able to boot from Medley RAID, I've tried a lot of ways to make this work, all failed. GRUB seems to insist that the partition table on the RAID device is corrupt.

On the other hand, LILO worked quite well. Just make sure you give LILO the BIOS drive mapping for the RAID device, and you should be fine. For my Asus A7N8X the BIOS drive number for the RAID is 0x81, I suspect it would be 0x80 if I didn't have a disk on the NForce interface. Snippet from lilo.conf:

# Use 32-bit LBA mode to access the device

# MBR to install LILO to:
boot = /dev/ataraid/disc0/disc

# BIOS mapping
disk=/dev/ataraid/disc0/disc bios=0x81  # Try 0x80 if this doesn't work

image = /boot/vmlinuz-2.4.23-pre7
        root = /dev/ataraid/disc0/part11
        append = "devfs=mount"
        vga = 0x0305
        label = Gentoo

other = /dev/ataraid/disc0/part1
        label = Windows
        table = /dev/ataraid/disc0/disc

Download Medley RAID patch source

Important! If you are using Linux 2.4.26 or above, you do not need to download and install this patch as it is already included in the official kernel.

Users of Linux 2.6 or above cannot use this driver, you should use Carl-Daniel Hailfinger's raiddetect tool, which incorporates my Medley detection code. You can find it here:

The latest version of the patch should work with the latest 2.4 vanilla kernel sources (at least version 2.4.21 up to 2.4.25). Use the latest version of the patch even if you have an older kernel.

Download a precompiled module

These modules are for very specific kernels released by the various Linux distribution vendors. Due to the subtle differences in modules depending on the version of compiler used and patches applied to the kernel source, these modules should generally be used only with the exact kernel and system they were made for. To request a module for your distribution's installer, please send me detailed instructions on where to obtain kernel source and configuration as well as exact version of GCC used to build the kernel. If you manage to build a module for your installer, copy the gcc command line used to build medley.o and send the output of "gcc -v" as well. I will not accept binary modules built by others due to the security risk involved.

The modules are primarily intended for users who want to load the module from within their distribution's installer, so they can install directly to a striped Medley array.

Deprecated Precompiled Modules

These precompiled modules are not recommended for use, since too many people have problems with them due to small differences in kernel versions compiled by different vendors. I will not provide support for problems arising due to their use. These modules are based on version 4 of the patch.

There are two modules here, and several versions of each. ataraid.o is the support module required for all ATA RAID drivers, including Medley. Many kernels will already have this built in so you may not need this. If you do need it, you will have to load it before medley.o.

These modules are available for 2.4.22 and they might work for slightly older kernels as well (2.4.2x is a good bet). This version will not work with 2.4.23 and above, but I expect to release a new binary when Linux 2.4.23 has been released.

Which module to use depends on the configuration of the kernel. If you have an SMP kernel (one that supports multiple CPU's), you must use the SMP version, otherwise choose the normal one. If you can access a shell you can see if it's an SMP kernel by typing cat /proc/version and see if SMP is mentioned.

The module to use also depends on whether your kernel has module versions enabled (CONFIG_MODVERSIONS in the kernel configuration). There is no easy way to find out, so try both.

The modules might work on patched kernels and have to be loaded with insmod -N, and even on other versions than 2.4.22, in which case you have to load them with insmod -f. No guarantees it will work though.

Compatibility list and feedback

This driver has been reported to work with the following configurations:

So far, no configurations have been reported as non-working.

Any feedback is highly appreciated. Even if it's just to say "It worked for me" or "It didn't work" - please include some information about your configuration. I'll be happy to try to help if you have problems getting it to work. But please use the mailing list for all support questions (see under News above).


I've written a program to spawn daemons that you want running all the time, when you don't want to run it from inittab or if you don't have root access on the box. It's very undocumented, but you can get it here.

Just build it with "make respawn" and (if you have root access) install it to /usr/bin.

Run "respawn -h" for help or read below:

respawn [OPTIONS]... start FILE [ARGS]...
       Executes FILE in the background, automatically restarting it if it
       dies, optionally saving its standard output and standard error.

respawn [OPTIONS]... stop
       Stop a program, by signalling the watching process.

respawn [OPTIONS]... restart
       Cause the program to be reloaded by signalling the watching process

  -d, --chdir=DIR      Change to the specified directory before starting.
  -l, --logfile=FILE   Log program's standard output and standard error
                       to FILE (only useful when starting). If not specified,
                       output will go to /dev/null.
  -q, --quietlog       Don't log the program's standard output and error,
                       only spawn and exit messages.
                       to FILE (only useful when starting). If not specified,
                       output will go to /dev/null.
  -o, --truncate-log   Truncate the logfile. Otherwise, append to it.
  -p, --pidfile=FILE   Save the PID of the watcher process to FILE. If not
                       specified, the PID file is not saved and stop or
                       restart will not work.
  -t, --delay=VAL      Delay for VAL seconds before respawning program when
                       it has terminated (default: 10).

Report bugs to thomas at

Copyright © 2003-2006 Thomas Horsten. All Rights Reserved.
All software on this page Copyright © 2003-2006 Thomas Horsten and released under the GNU GPL.
Last modified: Fri Jan 19 12:18:23 GMT 2007

Banner: Powered by Debian   Valid HTML 4.01!   Valid CSS!