# Linux ATA RAID HOWTO

murty@solar.m u r t y.n e t

April 26, 2002

Revision History
Revision 2.02002-05-10Revised by: mr
Major enhancements
Revision 1.32002-05-07Revised by: jyg
format fixes
Revision 1.22002-04-30Revised by: mr
Minor fixes
Revision 1.12002-04-28Revised by: ldl
Some minor changes and sgml-improvements
Revision 1.02002-04-26Revised by: mr
Initial Release

1. Introduction
1.2. Disclaimer
1.3. New Versions
1.4. Credits
1.5. Feedback
1.6. Translations
2. Requirements
3. Prepare Promise Driver Floppy
4. Preparing RedHat 7.2 CDs
5. Installing Red Hat 7.2
6. Installing Native Linux RAID
7. Installing on an existing Linux system
7.1. Append Line
7.2. Determining the Append Line
7.3. Setting Up RAID 1
8.1. Promise Technology (ft) Driver with OS on RAID mirror
8.2. Promise Technology (ft) Driver with non-OS data on RAID mirror
8.3. Linux Native (ataraid) Driver with OS on RAID mirror
8.4. Linux Native (ataraid) Driver with non-OS data on RAID mirror
9. Disabling RAID feature on Promise FastTrack
9.1. Case 1: OS not using RAID
9.2. Case 2: OS is using RAID
10. Tips and Important Notes
A. How is this document generated

# 1. Introduction

The goal of this HOWTO document is to explain how to setup RAID 1 (mirroring) with the two hard disks and install bootable RedHat Linux Operating System on the mirror device. This document discusses both methods of achieving this goal: 1. Using Promise supplied driver 2. Using Linux native RAID. If you choose the first method (using Promise supplied driver), you must use the Kernel 2.4.7-10 that comes with RedHat 7.2 CD. If you choose the second method, you can upgrade the kernel to the latest kernel (2.4.18). This document does not discuss Striping or other disk configurations, although the author believes that this document might help setup those configurations. This document does not yet cover: 1. Installation using GRUB instead of LILO and 2. Installation with Latest development kernels (2.5.x).

First of all we need a bit of legalese. Recent development shows it is quite important.

This Linux HOWTO document may be reproduced and distributed in whole or in part, in any medium physical or electronic, as long as this copyright notice is retained on all copies. Commercial redistribution is allowed and encouraged; however, the author would like to be notified of any such distributions.

All translations, derivative works, or aggregate works incorporating this Linux HOWTO document must be covered under this copyright notice. That is, you may not produce a derivative work from this HOWTO document and impose additional restrictions on its distribution. Exceptions to these rules may be granted under certain conditions; please contact the Linux HOWTO coordinator at this address .

In short, the author wishes to promote dissemination of this information through as many channels as possible but wish to retain copyright on this HOWTO document, and would like to be notified of any plans to redistribute this HOWTO document.

## 1.3. New Versions

The newest version of this HOWTO will always be made available on my website http://www.murty.net/ataraid/, or you may contact me directly at to check if there is a newer version.

Currently, this document is available in the following formats:

Note that paper sizes vary in the world, A4 and US letter differ significantly. You might also wish to consider using the universal format (8.27x11in; 210x279mm).

# 3. Prepare Promise Driver Floppy

1. Download appropriate driver from one of the two sites below and save the driver on one of the blank floppies. You can do this on any computer connected to Internet.

2. Insert the floppy with the driver tar ball into a working Linux computer and type:

 mount /dev/fd0 /mnt/floppy cd /mnt/floppy cp rhsmp-ft12014.tgz /tmp tar xvzf /tmp/rhsmp-ft12014.tgz cd / umount /mnt/floppy

3. Label the floppy »Promise FastTrack driver« and set it aside.

# 4. Preparing RedHat 7.2 CDs

NOTE If you already have Red Hat Linux 7.2 CDs 1 and 2, skip this step. Otherwise, read this step to learn how you can get them for free.

1. Logon to a Windows computer that has a CD Writer drive installed and setup properly. Insert a blank CD-R into the CD Writer.

2. Browse and locate enigma-disc1.iso (the first disk of Red Hat 7.2), and save this file to your Windows desktop.

3. Right-click on the iso image created on your desktop and choose "Record to CD" It will then write the iso image onto your CD-R and create disk-1.

4. Repeat the procedure for the second iso file named enigma-disc2.iso on ftp.redhat.com/pub.

5. Test to make sure your CD-Rs are indeed readable. If you click on »My Computer« and click on the CD Writer Drive icon, you should be able to browse the contents of the CD-R.

6. Label the CD-Rs properly: RH 7.2 disk-1 and RH 7.2 disk-2

# 5. Installing Red Hat 7.2

Once you have created your CDs, you are ready to begin installing Red Hat 7.2 on your Linux system.

If your machine is SMP, you will have to manually create initrdsmp.img, when you boot into Uniprocessor Kernel as shown below, and edit /etc/lilo.conf and then test to see you can boot into SMP system.

At this point, you have a working Red Hat 7.2 machine with SMP support, if applicable. If you are happy with the fact that you are running a fake Hardware RAID from Promise FastTrack using SCSI Emulation, then read no further.

Because Promise Driver is a SCSI emulation, it puts a lot of load on CPU(s). Read on if you want to enable true Linux native RAID and get rid of this Promise SCSI emulation.

# 6. Installing Native Linux RAID

The first step you want to take is to configure your networking and connect your computer to Internet, which is still running under Promise Driver SCSI emulation. Next you will install native Linux RAID.

 cd /usr/src/ tar xvzf linux-2.4.18.tar.gz cd linux # cd to kernel source directory just created by tar cp config.txt .config #(See NOTE below to find out where to get config.txt) make menuconfig

NOTE You can download a working config.txt file HERE. You can, of course, modify this to suit your needs either directly in a text editor or by typing make menuconfig as explained above. It is easy to make mistakes if you are editing .config directly in vi or emacs. Therefore, it is recommended to use Menu Interface by typing make menuconfig.

3. Enable all the following in the kernel statically (NOT as modules):

  ATA/IDE/MFM/RLL Support --> <*> ATA/IDE/MFM/RLL Support IDE/ATA/ATAPI Block Devices --> <*> Enhanced ATA/IDE/MFM/RLL disk/cdrom/tape/floppy support <*> Include IDE/ATA-2 Disk Support [*] Use multi-mode by default Include IDE/ATAPI CDROM support [*] Generic PCI IDE chipset support [*] Sharing PCI IDE interrupt support [*] Generic PCI Bus master DMA support [*] Use PCI DMA by default when available [*] Intel PIIXn chipset support [*] PIIXn tuning support [*] Promise PDC202{46|62|65|67|68} support [*] Special UDMA Feature [*] Special FastTrack Feature [*] VIA 82CXXX chipset support <*> Support for IDE RAID controllers <*> Support Promise Software RAID (fasttrack)

4. After you have enabled static features as shown above, make any more changes that you would like to make to suit your environment.

5. Save the kernel configuration. It is saved to .config in the current directory. Please back up this file. If you dont do so, you will regret it later. Copy .config file in a blank floppy or in /root

6. Build and install the kernel like you normally do, by typing:

 make dep ; make clean ; make && make install make modules && make modules_install

Look at /etc/lilo.conf to make sure new lines are added to boot your new kernel 2.4.18. Note that there should not be an initrd= line for this new kernel in /etc/lilo.conf. That is, our new kernel will boot itself without depending on a initrd.img unlike your current 2.4.7-10 kernel.

1. Locate the root=/dev/sdaX line for the new kernel in /etc/lilo.conf. Change this to root=/dev/ataraid/d0pX where X is a number 1 through 16. Save your changes.

2. Type:

 /sbin/lilo

3. If you chose any ext2 partitions during installation, you should comment them out in /etc/fstab for now.(Best thing is: Forget ext2 in this whole process)

4. Remove all floppies and CDs, and reboot by typing:

 sync;sync;reboot

5. At the LILO prompt, type your new kernel lable corresponding to 2.4.18 Your computer should then boot into your new kernel.

6. Login and type df -k to make sure you see /dev/ataraid/d0X entries instead of earlier /dev/sdaX entries.

NOTE You may see some errors related to mounting swap device at the time of booting into new kernel. These are harmless. You should edit /etc/fstab to change any sdaX entries to ataraid/d0pX entries.

8. Remove the existing lilo on your computer by typing: rpm -e --nodeps lilo

9. Install new version of lilo as follows:

 tar xvzf lilo-22.tar.gz cd lilo-22 # cd to lilo source directory just created by tar ./QuickInst.sh 

10. Say "Yes" to questions the system will ask you.

11. Ignore any errors except if /sbin/lilo is not created.

• Replace linear by lba32

• Delete line "compact"

• Change vga= line to vga=normal

• Change boot=/dev/sda line to boot=/dev/ataraid/dN (where N is the partition number on which your root file system exists. Type df -k / to find out your root partition number).

• Make sure that default=linux-2.4.18 (where linux-2.4.18 is the label given to boot your new kernel: 2.4.18)

13. Save changes to the file and type: /sbin/lilo

14. Reboot the system and cross your fingers.

Here is how the final /etc/lilo.conf should look like.

If everything comes up without any errors, time to celebrate!!

Read this section carefully before you plan to upgrade kernel on your Linux machine with Promise FastTrack RAID. Unless you are not using Promise FastTrack at all in any way, you need this information to avoid problems.

Always backup your data before kernel upgrade. Also backup /etc/fstab, /etc/lilo.conf, /boot/vmlinuz-currentversion and /boot/initrd.img (if you use initrd). When you upgrade your kernel, do not delete old kernel or its dependent files in /boot and do not delete the lines corresponding to it in /etc/lilo.conf. If you upgrade kernel to say 2.4.19, just create another kernel section in /etc/lilo.conf. For example, add the following lines to /etc/lilo.conf:

  # Begin Code for booting my brand new kernel: 2.4.19 image=/boot/vmlinuz-2.4.19 label=linux-new read-only root=/dev/ataraid/d0p12 # End Code for booting my brand new kernel: 2.4.19 

Also, do not change default=linux line in /etc/lilo.conf unless and until you successfully can boot into your new kernel by typing linux-new at the boot: prompt (or highlighting linux-new in the menu, if you are using LILO in curses menu mode).

Now lets discuss the actual process of upgrading kernel in the following four cases:

OS stands for "Operating System" or more specifically Red Hat Linux Operating System in our case. When you install Linux on mirrored partitions such as /dev/ataraid/d0p1 (or /dev/sda1 when using Promise Technology proprietary driver), you are said to have your OS on RAID mirror. If your Linux machine has only the main partitions such as / and /boot on RAID, it is also called (a case of) OS on RAID.

Partitions created by user to make use of available free partitions such as /mydata1, /imp, /scratch are not part of Linux OS because Linux does not install any files into them by default when you install Linux or upgrade any standard Linux software package. Any data in such user partitions becomes user data or alternatively, non-OS data. It is a good idea to use only ext3 and swap file systems for OS partitions. For non-OS partitions, you can use other file systems such as ext2 and dos (if you have another operating system like Windows on the same Linux computer or if you just feel like you love dos so much). However, why do you want to use ext2 if you dont have to and you have a better choice of using ext3 for OS or non-OS partitions?

## 8.1. Promise Technology (ft) Driver with OS on RAID mirror

Currently, Promise Technology supports Red Hat 7.2 and earlier versions only. Red Hat 7.2 uses kernel 2.4.7-10 by default. Also note that, you have to use initrd.img (Initial RAM disk image) in /etc/lilo.conf, when you install Linux with Promise supplied driver. At the time of installation, Promise Driver scripts are supposed to automatically generate initrd file and configure /etc/lilo.conf for you. Unfortunately, this does not work properly and you may have to manually create initrd.img and configure /etc/lilo.conf yourself.

You are stuck with the default kernel 2.4.7-10 and you cannot and should not upgrade kernel either by compiling or by automatic update programs such as up2date or rpm utility. If you really really want to upgrade kernel then do so but do not use raid. You can add Append Line to the /etc/lilo.conf as explained in Section 7.2 and do not load ataraid module (or do not compile your new kernel with ataraid feature built-in). By doing this, you are upgrading kernel to new version and sacrificing RAID feature because you are using Promise Technology card as a simple IDE extension card.

If Promise Technology releases new version of their ft driver for 2.4.19 in future, you can then upgrade your kernel first to 2.4.19 (using up2date or rpm but not by manually compiling) and place their new version of ft.o file in /lib/modules/kernel-2.4.19. You will also have to put initrd-2.4.19 in /boot and append initrd= line to the new kernel section in /etc/lilo.conf. If your Linux machine uses Promise Technology driver, your OS is on RAID mirror and Promise Technology did not release any new versions for new kernel versions, please do not fool around with your current kernel. If you do fool around, remember that you can seriously damage your computer and not be able to boot or retrieve your data.

## 8.4. Linux Native (ataraid) Driver with non-OS data on RAID mirror

Similar to previous case, do not attempt to upgrade kernel by any automatic method (up2date or rpm utility). Manually compile and your install your new kernel as explained in the previous section.

# 9. Disabling RAID feature on Promise FastTrack

If you are reading this section, then you may be sick and tired of the fake RAID feature (formally known as quasi-hardware RAID) provided by Promise Technology FastTrack card or onboard chip on your motherboard.

## 9.1. Case 1: OS not using RAID

It is possible to disable the RAID feature and use the Promise FastTrack as a plain vanilla IDE card. It is very simple. Follow the below steps:

1. Determine your Append Line. See Section 7.2 for help with this

2. Modify /etc/lilo.conf to include append="Append Line" in your current kernel boot section. Again see Section 7.2 for details.

3. Type /sbin/lilo and reboot

Now you should see your hard disks seperately and you can use them. If you previously had partitions on the RAID mirror, you will see partitions accordingly on each of the two member disks. You will also see the data that you previously stored on the RAID mirror.

 #!/bin/bash # # makehowto by Murty Rompalli # (c) All Rights Reserved # Free for non commercial use. All other uses must be authorized explicitly # by the creator. Contact me for more info. murty@solar.m u r t y.net # function maketut() { echo;echo Creating Tutorial Files ... jade \ -t sgml \ -d /usr/lib/sgml/stylesheets/nwalsh-modular/html/ldp.dsl\#html \ $1.sgml } function makehtml { echo;echo Creating html file:$1.html ... jade \ -t sgml \ -d /usr/lib/sgml/stylesheets/nwalsh-modular/html/docbook.dsl \ -V nochunks \ $1.sgml >$1.html } function maketxt { if [ -f $1.html ] then echo;echo Creating text file:$1.txt ... lynx -dump $1.html >$1.txt else echo;echo $1.html not found, creating ... makehtml$1 maketxt $1 fi } function makepdf { [ -f$1.ps ] && gzip $1.ps if [ -f$1.ps.gz ] then echo;echo Creating pdf file: $1.pdf ... gzip -dc$1.ps.gz | gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$1.pdf - else echo;echo$1.ps.gz not found creating ... makeps $1 makepdf$1 fi } function maketex { echo;echo Creating TeX file $1.tex ... jade \ -t tex \ -d /usr/lib/sgml/stylesheets/cygnus-both.dsl\#print \$1.sgml gzip $1.tex echo$1.tex gzipped to $1.tex.gz } function makedvi { echo;echo Creating DVI file$1.dvi ... db2dvi $1.sgml >/dev/null 2>&1 echo See$1.log for errors gzip $1.dvi echo$1.dvi gzipped to $1.dvi.gz } function makeps { echo;echo Creating PS file$1.ps ... db2ps $1.sgml >/dev/null 2>&1 echo See$1.log for errors gzip $1.ps echo$1.ps gzipped to $1.ps.gz } #### Begin Main Program echo " makehowto utility for generating HOWTO from SGML file. (c) Murty Rompalli " [ x$1 = x ] && echo "Error. Usage: $0 abc.sgml '{tut|html|pdf|tex|dvi|ps|all}' Option 'all' is default if sgml file is the only option supplied. Options: ------- tut Make complete tutorial, i.e., generate necessary html files html Make a printable single HTML file pdf Make a PDF file tex Make a TeX source file, gzipped dvi Make a DVI file, gzipped ps Make a PostScript file, gzipped all Generate all possible formats. " && exit file="echo$1|sed 's/\.sgml$//'" [ x$file = x ] && echo Error. Usage: $0 abc.sgml '{tut|html|tex|dvi|ps|all}' && exit [ -f$file.sgml ] || { echo Error. $file.sgml does not exist exit } [ -r$file.sgml ] || { echo Error. $file.sgml not readable exit } if [ x$2 = x ] then action=all else action=$2 fi case$action in tut|tutorial) maketut $file ;; html|htm) makehtml$file ;; tex|latex) maketex $file ;; dvi) makedvi$file ;; ps) makeps $file ;; text|txt) maketxt$file ;; pdf) makepdf $file ;; all) maketut$file makehtml $file maketex$file makedvi $file makeps$file maketxt $file makepdf$file ;; *) echo error ;; esac \rm -f $file.aux \rm -f$file.tex \rm -f $file.dvi echo;echo makehowto: Finished echo You can review$file.log and delete it. echo Thank you for using makehowto. echo