General thread-software RAID in the new Linux2.4 kernel, part 1

Source: Internet
Author: User
Article Title: General thread-software RAID in the new Linux2.4 kernel, Part 1. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
By Daniel Robbins
  
Installation and introduction
  
The new Linux 2.4 kernel is available! You should immediately find an idle PC and install Linux to see what it can do! In two articles about Linux 2.4 RAID, Daniel Robbins introduced a new technology that enhances disk performance and reliability by distributing data across multiple disks. The first section discusses the installation of software RAID (kernel and tool installation) and describes how to create a linear volume and a RAID-0 volume.
  
  
  
This new kernel contains many excellent new features and enhancements. One of them is the implementation of popular software RAID. Software RAID greatly enhances the I/O performance and reliability of Linux disks without having to purchase expensive hardware RAID controllers and accessories. Linux RAID is implemented by software, so it is flexible and fast... and interesting!
  
RAID miracle
The concept of software RAID is simple-enables you to combine two or more block devices (usually disk partitions) into a single RAID device. Assume that you have three separate zones: hda3, hdb3, and hdc3. With software RAID, you can combine these partitions and process them as a single RAID device/dev/md0. Next, you can format md0, create a file system for it, and use it like any other partition. There are also many different methods for configuring RAID volumes-some for maximum performance, some for maximum availability, and some for both.
  
There are two RAID modes: linear mode and RAID-0 mode. Technically, neither of them is RAID, because RAID represents a "redundant array of cheap disks", while RAID-0 and linear modes do not provide any type of data redundancy. However, both modes-especially RAID-0-are useful. I will give you an overview of the two RAID modes and will then gradually guide you through installing software RAID on your system.
  
Introduction to Linear mode
Linear mode is one of the easiest ways to combine two or more block devices into a "RAID" volume-just to connect the device. If you have three partitions, hda3, hdb3, and hdc3, each of which has a capacity of about 2 GB, they constitute a 6 GB synthetic linear volume. The first 1/3 of the linear volume is located on hda3, the last 1/3 is located on hdc3, and the Middle 1/3 is located on hdb3.
  
To configure a linear volume, you must have at least two partitions to connect. They can be of different sizes, or even belong to a physical disk at the same time, without negatively affecting performance.
  
Linear Applications
Linear mode is the best way to combine two or more partitions on the same disk into a single volume. Although doing so with other RAID technologies may cause huge performance losses, linear mode does not have this problem because it is not in parallel (as in other RAID modes) write the shards. However, for this reason, the linear mode tends to be inferior to RAID-0, RAID-4, and RAID-5 in terms of performance to some extent.
  
In general, linear mode does not provide any performance improvement based on non-traditional RAID partitions. In fact, if your linear volume is distributed across multiple disks, it is likely to become unavailable due to occasional hard disk failures. The failure probability of a linear volume is equal to the sum of the failure probability of a physical disk and a controller composed of a linear volume. If a physical disk is decommissioned, linear volumes are usually irrecoverable. Linear mode does not produce additional redundancy compared to a single disk.
  
However, linear mode is an excellent way to avoid re-partitioning a single disk. For example, assume that your second IDE drive has two unused partitions (hdb1 and hdb3 ). Assuming that the key data is stored in hdb2, you cannot repartition the drive. You can still combine hdb1 and hdb3 into a single linear volume with cohesion.
  
When you only need a single large partition (and there is no need to improve performance), linear mode is also a good way to combine partitions of different sizes on different disks. However, you can use a better technology than RAID for any other work.
  
Introduction to RAID-0 mode
RAID-0 is also a "RAID" mode without any "R" (redundancy. Even so, RAID-0 is extremely useful. This is mainly because it is the most promising mode in various RAID modes.
  
To install a RAID-0 volume, you must have two or more partitions of the same size (or almost the same. The RAID-0 code is read and written evenly among all the constituent partitions. RAID-0 doubles the I/O performance by reading and writing components in parallel. If you do not consider the complexity of the controller and bus bandwidth, a RAID-0 volume consisting of two shards on two identical disks provides almost twice the performance of a traditional partition. If you distribute your RAID-0 volume to three disks, the performance is almost three times that of the original one. This is why the RAID-0 array on the IDE disk is better than the fastest SCSI or FC-AL drive on the market. To truly enhance performance, you can install a group of SCSI or FC-AL drives in a RAID-0 array. This is the charm of RAID-0.
  
To create a RAID-0 volume, you need two or more partitions on different disks. The volume capacity is equal to the total capacity of each component partition. Just like in linear mode, you can use RAID-0 to combine block devices from various drives (such as IDE and SCSI drives) into a single volume.
  
If you are using an IDE disk to create a RAID-0 volume, you should try your best to use a disk and controller that complies with UltraDMA for maximum reliability. At the same time, to avoid performance degradation, only one drive-slave device should be connected on each IDE channel (especially when it is part of the RAID-0 array) the negative impact on speed will almost offset all the performance advantages of RAID-0. You may also need to add an IDE controller to provide the additional IDE channel you need.
  
If you want to create a RAID-0 volume with a SCSI device, be sure not to let the total throughput of all drives exceed the maximum throughput of the SCSI (and PCI) bus. In this case, the SCSI bus will be a factor limiting performance. For example, if you install four drivers with a maximum throughput of 15 Mbit/s on a 68-pin Ultra Wide bus with a speed of 40 Mbit/s, sometimes the driver is saturated with the bus, and the performance will rise to a value close to 40 Mbit/s. This may be quite good for your application (after all, 40 Mbit/s IO is not too bad !), However, its peak IO performance may only be the same as the peak IO performance of RAID-0 volumes using three drives.
  
RAID-0 application
From the reliability standpoint, the RAID-0 mode has the same characteristics as the linear mode-the more drives are added to the array, the higher the failure probability of the volume. In addition, as in linear mode, the decommission of a single drive will kill the entire RAID-0 volume and cannot be restored. To calculate the fault probability of your RAID-0 volume, you only need to add the failure probability of all the drive components.
  
RAID-0 is ideal for applications that require maximum IO performance because it is currently the best performing RAID mode. However, remember that this mode should be used only when you are able to withstand more risks of volume faults.
  
If you are setting compute farm or a web Cluster, RAID-0 is an excellent way to improve disk I/O performance. In this case, you will have some off-the-shelf redundancy (a large number of slave machines), so your resources are still available in the following rare cases: you must turn off the faulty machine on the hard drive to replace the drive and restart it.
  
Configure Linux 2.4 software RAID
Two steps are required to enable Linux 2.4 to support software RAID. First, RAID support should be enabled at the kernel level. This usually requires recompilation and installation of a new kernel, unless you are already using a Linux 2.4 kernel with built-in RAID support.
  
Then, you need to compile and install the raidtools software package. Raidtools is a user-level tool that allows you to initialize, start, stop, and control RAID volumes. After completing these two steps, you can create your own RAID volumes, create a file system on these volumes, and then mount these volumes.
  
Kernel problems
I am using the 2.4.0-test10 kernel. I recommend that you use the latest 2.4 kernel, at least 2.4.0-test10 kernel (but not 2.4.0-test11 because it has serious system file corruption issues ). You can find a recent kernel on kernel.org, or find a tutorial on how to recompile and install a new kernel on developerWorks (refer to the reference resources section below this article ).
  
Configure the kernel
I recommend that you configure the kernel so that you can add software RAID support at the kernel level (instead of as module support ). After you enter "make menuconfig" or "make xconfig", you will find that the software RAID settings are in the "Multi-device support (RAID and LVM)" section. We also recommend that you enable RAID-related support, including "Boot support" and "Auto Detect support ". This will allow the kernel to automatically start the RAID volume during boot. if you want to, you can also create a RAID root file system. The following is a snapshot of "make menuconfig. The last two options (supported by LVM) are not required, even though I have compiled them into the kernel:
  
Configure the kernel to support RAID
  
  
Install the kernel and reboot it after proper kernel configuration. Search for the latest version of raidtools.
  
Install raidtools
Search for the latest version of raidtools before installing it. You can usually find the raidtools program at kernel.org. Find the latest "raidtools-0.90" file (not raid0145 !). The latest is raidtools-19990824-0.90.tar.gz ".
  
If you are adventurous (if you are using the 2.4.0-test kernel, you are taking an adventure), you may want to visit the RedHat website (see reference resources) obtain the latest version of raidtools that you can find. The latest is raidtools-dangerous-0.90-20000116.tar.gz ".
  
To install raidtools, unpack the archive file. Run the following command:
  
  
# Cd raidtools-0.90
#./Configure
# Make
# Make install
  
  
  
  
  
Haha -- the raidtools-0.90 has been installed. Now you can use software RAID at any time. To ensure that the RAID support of the kernel is effective, ensure that the/proc/mdstat file exists. This file contains the current configuration of the software RAID:
  
  
# Cat/proc/mdstat
  
  
  
  
  
Partition settings
Now we have prepared disk partitions. you need at least two disk partitions. If you are using RAID-0, make sure that these disk partitions are located on different disks and their sizes are similar. There is no doubt that the data on these disks will be damaged.
  
Note: When creating a partition, specify the partition type as "FD ". This will enable nuclear energy in Linux to recognize them.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.