Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

7. Installing on an existing Linux system

This section explains how to install Linux Native ATA RAID on non-OS disks you may have on a running Linux machine. Non-OS disks are those which do not contain any Linux OS partitions such as /, /usr, /var, /boot. In other words, we have a working Linux machine with two free disks and we want to setup ATA RAID mirror (raid 1) on those two disks. When we save important data on such a mirror device, our data is protected. Ofcourse, like any other RAID 1, we will experience improved read speeds while reading the data and slightly decreased write speeds while modifying or adding new data to the mirror device. Therefore, using RAID 1 for data disks is recommended if the data disk is more frequently read than written to. A web server hosting rarely changing web sites is a good example where web content is rarely modified but very frequently accessed by users.

Here are the steps to install non-OS ATA RAID if your RAID chip is from Promise Technology:

7.1. Append Line

For the purpose of understanding various tasks involving Promise FastTrack RAID such as upgrading or troubleshooting, we introduce a noun: Append Line

All the ide options you pass at the LILO boot: prompt at the time of booting, when put together as a string, make up the Append Line. All the ide options in double quotes after append= keyword in /etc/lilo.conf also make up the Append Line.

For example, if you type

linux-new ide2=0x0001,0x0009,9 ide3=0x2000,0x2009,10 ide4=none nousb expert root=/dev/hda3

at boot: prompt at the time of booting your Linux computer, then Append Line is the string

ide2=0x0001,0x0009,9 ide3=0x2000,0x2009,10 ide4=none.

Similarly, if your /etc/lilo.conf has the following section, your Append Line is

ide2=0x9400,0x9002 ide3=0x8800,0x8402.

image=/boot/vmlinuz-2.4.9-10
        label=linuxold
        read-only
        root=/dev/hde9
        append="nousb ide2=0x9400,0x9002 ide3=0x8800,0x8402"
        initrd="initrd.img"

When we experience problems booting a Linux machine with RAID, we may have to use an appropriate Append Line. Therefore, it is important to determine and write down the Append Line. This will help you fix your problems later or upgrade your kernel smoothly or add/remove additional hard disks.

7.2. Determining the Append Line

To determine the correct Append Line, we should first know how all our ide devices are connected. IDE devices can be hard disks, ATAPI CDROM(s) etc. Once we determine the Append Line, we can append it to the boot: options (at the time of booting) or we can alternatively assign it as a string value to the append paramater in /etc/lilo.conf. Unless you love to remember complicated boot: options and type them at boot time every time, you should choose the second method, i.e., insert it into /etc/lilo.conf . You can do so by inserting append="Your Append Line Here", saving file and then activating new /etc/lilo.conf by running the command /sbin/lilo.

For the purpose of understanding better, lets say that your ide devices are as follows:

  • ide0: hda , hdb (hard disks)

  • ide1: hdc , hdd (hard disks or other ide devices like CDROM)

  • ide2: hde (first free disk)

  • ide3: hdg (second free disk)

The two free disks above (hde and hdg) are the ones we would like to setup as RAID 1 to create /dev/ataraid/d0 raid device. Note that we do not have hdf or hdh because that is how we used the IDE/RAID ports on Promise chip. It is not a good idea to connect two hard disks to the same Promise controller IDE port. In the above example, we used Primary Master and Secondary Master connections on the Promise Technology card.

If you do not know how various ide devices are connected in your computer, take a look at /proc/devices and /proc/ide/*. You can also carefully go through boot log file, /var/log/bootlog (or type dmesg | more right after your Linux system boots) to find your ide devices. Now type less /proc/pci and locate appropriate information about Promise Technology. In the output of less /proc/pci, you can see somewhere information about your Promise chip, something like:

 Bus  0, device  17, function  0:
    Unknown mass storage controller: Promise Technology Unknown device (rev 2).
      Vendor id=105a. Device id=d30.
      Medium devsel.  IRQ 10.  Master Capable.  Latency=32.  
      I/O at 0x9400 [0x9401].
      I/O at 0x9000 [0x9001].
      I/O at 0x8800 [0x8801].
      I/O at 0x8400 [0x8401].
      I/O at 0x8000 [0x8001].
      Non-prefetchable 32 bit memory at 0xd5800000 [0xd5800000].

From this output, we learn that our Promise Technology card uses IRQ 10 for both ide ports (ide2 and ide3). Using same IRQ is perfectly alright as long as your kernel supports PCI IRQ Sharing. By default, our Linux kernel is configured to support PCI IRQ sharing. From the above output, we also learn that our Promise Technology card uses various IO addresses. For the purpose of identifying Promise Technology disks properly at boot time, we only want the IRQ number(s) and the first four IO Address numbers outside [ ]. Write down on a piece of paper this information. In this case, from the above output:

IRQ1 = 10
IRQ2 = 10
IO1 = 0x9400
IO2 = 0x9000
IO3 = 0x8800
IO4 = 0x8400

Now, we have to evaluate the following to obtain the correct Append Line. Then either specify this Append Line at boot time or specify it in lilo configuration file.

ideX=IO1,IO2+0x0002,IRQ1 ideY=IO3,IO4+0x0002,IRQ2
where ideX and ideY are the two IDE ports of Promise card our free disks are using.

In our example, the above Append Line will become:

ide2=0x9400,0x9002,10 ide3=0x8800,0x8402,10

If, for example, we want to boot kernel version 2.4.18, labelled linux according to /etc/lilo.conf, then we specify our Append Line in one of the following two methods:

  1. At boot time

    boot: linux ide2=0x9400,0x9002,10 ide3=0x8800,0x8402,10
    
    If you choose this method, you should manually type the Append Line after the kernel label linux everytime you boot your Linux machine.
  2. In /etc/lilo.conf

    image=/boot/vmlinuz-2.2.18
            label=linux
            read-only
            root=/dev/hda1
            append="ide2=0x9400,0x9002,10 ide3=0x8800,0x8402,10"
    
    If you choose this method, you have to run lilo once to activate changes by typing /sbin/lilo. And you do not have to type anything extra at boot time.

7.3. Setting Up RAID 1

If you want to setup RAID 1 using Promise Technology proprietary driver (ft.o), you can download Promise Driver (ft.o) into /lib/modules/kernel-version and load the module by typing modprobe -k ft. You should then be able to access your new raid device as /dev/sdc or something like that. But if it does not work, then determine your Append Line and add it to /etc/lilo.conf. If you are setting up RAID on an existing Linux system and are using either Promise Technology ft driver or Linux native ataraid driver, then use of Append Line in /etc/lilo.conf is strongly recommended. Once you reboot with your new /etc/lilo.conf that contains Append Line, you can load either driver (ft.o from Promise Technology or ataraid.o, the Linux Native RAID module) to enable RAID except when your kernel has built-in ataraid support in which case you do not have to load ataraid module.

As Linux Native RAID is recommended, let us discuss that in detail. To setup Linux Native RAID on an existing Linux machine, insert Append Line into /etc/lilo.conf as explained above. Now, activate changes by typing /sbin/lilo. Then reboot your computer. After your computers reboots, load ataraid module manually if your kernel does not have ataraid built-in support or ataraid.o module failed to load for some reason. If you compiled your kernel with static ataraid support (ataraid not as module), then you can start formatting and using your mirror disk /dev/ataraid/d0 right away.

But if you compile ataraid as a seperate module, then type lsmod and see ataraid is listed. If not, manually load it by typing modprobe -k ataraid. If you dont see any errors, then you can start using your mirror disk /dev/ataraid/d0 right away. Format it, mount it and use it just like you normally do.

The fact that you can use /dev/ataraid/d0 implies that you are successful in your mission. Please do not access /dev/hde, /dev/hdg or any of their partitions directly, although Linux will let you do that. Once you make a mirror device from two disks, you should always access the mirror device and not the disks directly.