These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX02/Install Knoppix On A Software RAID

Classnotes | UNIX02 | RecentChanges | Preferences

Configure and setup a simple software RAID (level 1) using two partitions under Knoppix. Then install Knoppix on this software RAID.

Some notes to be aware of:

  • The version of Knoppix we use in this classroom requires approximately 2GB of free-space to install.
  • Knoppix's knx-hdinstall script will not install to a RAID device. However, all that knx-hdinstall does is cp -dRvp everything (excluding /proc) from /KNOPPIX.
  • Once you have installed, you will need to edit and setup /etc/fstab, /etc/raidtab, and /etc/lilo.conf accordingly.
  • When you are done, do not reboot! The Linux kernel under Knoppix does not have software RAID compiled in the kernel. (See next section).

General Steps

Here are the general steps you could take in performing this. Until you get a bit more familier with the ideas involved, I wouldn't recommend deviating too much from these instructions.

1- Partition your drive
In the "real world" you would have more than one hard drive in your machine to set this RAID up on. In this class, however, we only have the one drive. Because we want to mimick what you would do in the "real world" as much as possible, you will probably want 4 partitions.

In a production system, you would probably have something similar to the following set up:

drive 1: <partitions for /, /home, etc.>
drive 1: <swap>

drive 2: <partitions for /, /home, etc.>
drive 2: <swap>

Partition your drive similarily.

2- Configure Knoppix's RAID
Before we can actually format the RAID array let alone install to it, Knoppix must know about it. Configure Knoppix's /etc/raidtab to reflect your RAID array.

Note: /etc/raidtab, as well as any other files you create for Knoppix, will be stored in Knoppix's RAM-disk. This means that when you reboot, unless you commit these files to some more permanent media (like, oh... Idunno, the hard drive) they will be lost.

3- Initialize the RAID Array
Run the commands to make the RAID arrays and to make the filesystems to be placed on those arrays. The safest choice would be EXT2 or EXT3, however, if you wanted to experiment with SGI's XFS or Reiserfs, now would be a good time to do so.

You will also want to initialize your swap space and any other file systems you will be using.

4- Mount the RAID Array
Now that you have made the RAID array and the filesystem on it, you will need to mount the system onto something Knoppix has access to so that you can begin copying.

There are many different choices as to what you could do here, but perhaps the easiest would be to create a target directory where the RAID will be mounted.
# mkdir /target

After that, you will simply mount the RAID to it. Remember that the RAID devices are named differently than traditional filesystems. So, for example, if my RAID device was /dev/md3 I would type:
# mount /dev/md3 /target

Bear in mind if you have some esoteric filesystem, you may have to specify the filesystem type.

5- Make the basic filesystem
It is not necessary to do every aspect of this step, but we will do it anyway for completeness. Doing this step helps give us a better visualization about where we are installing to.

Basically, we only need to create /proc on our filesystem (as this will be where our system process information will be stored), but we will create a few others as well:
# mkdir /target/usr
# mkdir /target/home
# mkdir /target/var
# mkdir /target/proc

If we had a more "real" RAID system, then we would mount the appropriate /home, /usr, etc. filesystems here.

6- Copy Knoppix to the RAID
This step will take a while. We now have an empty filesystem waiting for Knoppix to be placed on it. Knoppix contains about 2GB of data. Every byte that is written to this drive must be written twice (in each element of the RAID array). Thus, installing Knoppix will take twice as long.

Note: If we had a dedicated IDE card for the second (or even both) drives then we would get better performance. By placing both RAID partitions on one drive we are only using one write head and one IDE bus. By placing both RAID partitions on two drives on the same IDE bus we would get a slight increase in speed as we would have two write heads on one IDE bus. However, by offloading the second drive to a dedicated IDE card we would get the best performance with two write heads on two IDE buses.

You will need to copy everything from Knoppix, except for /proc. You may also want to skip /opt, as that is where OpenOffice? (which is a rather large package) is installed. So, you will want to first change into the target directory, and then copy each of the directories you need:

# cd /target
# cp -dRvp /etc
# cp -dRvp /bin
# cp -dRvp /usr

If you want to come with a simple shell script which handles this for you, feel free.

7- Edit target install's /etc/raidtab
The target install now needs an appropriate raidtab configuration file. The easiest way to get one for it is to copy the one you made for Knoppix to it:

# cp /etc/raidtab /target/etc/raidtab

8- Edit target's fstab
You will now need to edit the target machines /etc/fstab file. If you need a refresher, refer back to UNIX02/The Fstab File which we covered earlier in this course.

9- Specify RAID Autodetect
In order for Linux to boot from a RAID array, we must ensure that it is able to detect which drives/partitions are part of the RAID devices. To do this, we must make the partitions "RAID Autodetect" types. If you haven't already (you could have done this earlier) run cfdisk and set the filesystem types for the RAID partitions to RAID Autodetect, or 0xFD.

You should now have a fairly functional Knoppix install to the hard drive. However, do not reboot, at present you are lacking two things:

    1. Your bootloader
    2. A kernel capable of booting from RAID

NOTE: The resulting system you have will not be a terribly functional Debian system. Knoppix takes certain liberties (such as custom run-levels and auto-logins) which make it unsuitable for use this way in a production environment. The proper way to do this install would be to first do a knx-hdinstall to a non-RAID filesystem, and then copy the files from this filesystem into your RAID (in the same fashion we have detailed above). This would leave you with a proper Debian system. However, as we have rather limitted hard drive space in this class, we cannot do this.

Classnotes | UNIX02 | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited September 21, 2003 8:36 pm (diff)
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.