Article title: set RAID in RedHat6.0. 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.
Abstract: The installation described in this article is carried out on RedHat 6.0, and I think it can be used in other Linux versions. When will I switch to Debian? I hope to do it as soon as possible.
I. INTRODUCTION to RAID
I suggest you read the software RAID HOWTO written by the jakob@ostenfeld.dk. Obviously, he is a Danish. Denmark is the best country in the world where many smart people live. He wrote this HOWTO article very well. maybe I don't have to write this article at all. I wrote this article because the document is generally not easy to understand. of course, the situation has greatly improved. The installation described in this article is performed on RedHat 6.0, and I think it should be available in other Linux versions. When will I switch to Debian? I hope to do it as soon as possible.
What is RAID? Simply put, it allows you to do interesting things on several hard disks. It allows you to combine several hard disks and store data in these disks separately. It can speed up reading and writing data to the hard disk, or back up data on the hard disk. In this way, even if one hard disk breaks down, you can recover all data from other hard disks. You can read the RAID level section of software raid howto to better understand different types of software RAID.
To test the example in this article, you need to set some small partitions. I suggest you set a 1 GB extended partition and create some 100 MB logical partitions on this extended partition. Remember that you can only test on an unimportant hard disk. If you destroy the data on this hard disk, it is your own fault. Even if I write something wrong in my article, you must be responsible for what you do.
2. strip RAID)
I will only describe how to set RAID entries to store data. That is to say, I will not place the main part of the operating system on the RAID strip. Using RAID bars will cause some problems for storing the entire system, so I am not prepared to do so.
To put it simply, it takes four steps to set RAID strip on Linux. Strip stores data on two or more hard disks (actually partitions). half of the data is on one hard disk, and the other half is on another hard disk. In this way, the read and write speed of the hard disk can be improved because the data is read from both hard disks at the same time. Again, you can read more details in HOWTO.
First, we need to configure/dev/md0, then we need to format these partitions, and then we need to configure/etc/rc. d/rc. local to activate RAID, and finally configure/etc/rc. d/rc. local to install these devices to a directory.
Procedure
Now, I want to use some tips. I think most low-end users do not have two hard disks, so I want to use two partitions on the same hard disk instead of two hard disks. Create an extended partition with two logical partitions. The two partitions,/dev/hda5 and/dev/hda6, must have the same size. RAID strip between two partitions on the same hard disk makes no sense, even on different hard disks of the same IDE controller. Remember, this is just an exercise.
Run the following command to format the partition:
Mkraid/dev/md0
If you encounter some problems when using the "mkraid" command, it should give a prompt on how to solve the problem. Run the following command:
Mkfs-t ext2/dev/md0
Then, you can check the raid status in the "/proc/mdstat" file.
Cat/proc/mdstat
Run the following command to add a line in/etc/rc. d/rc. local.
Echo "raidstart/dev/md0">/etc/rc. d/rc. local
Run this command once. You can create a directory for the RAID device and add a command in/etc/rc. d/rc. local.
Mkdir/RAID
Echo "mount/dev/md0/RAID">/etc/rc. d/rc. local
If you don't want to restart your computer, you can activate RAID now,
Raidstart/dev/md0
Mount/dev/md0/RAID
You can use this command to check the installed directory.
Df
III. RAID images
Like the above example, I want to use two partitions on the same hard disk, and I only mirror the data partition.
First, set/dev/md0, format the partition, and configure/etc/rc. d/rc. local to activate raid, and finally configure/etc/rc. d/rc. local to install the image device to a directory.
Run the following command to format the partition:
Mkraid/dev/md0
If you encounter some problems when using the "mkraid" command, it should give a prompt on how to solve the problem. Run the following command:
Mkfs-t ext2/dev/md0
Then, you can check the raid status in the "/proc/mdstat" file.
Cat/proc/mdstat
Run the following command to add a line in/etc/rc. d/rc. local.
Echo "raidstart/dev/md0">/etc/rc. d/rc. local
Run this command once. You can create a directory for the RAID device and add a command in/etc/rc. d/rc. local.
Mkdir/RAID
Echo "mount/dev/md0/RAID">/etc/rc. d/rc. local
If you don't want to restart your computer, you can activate RAID now,
Raidstart/dev/md0
Mount/dev/md0/RAID
You can use this command to check the installed directory.
Df
4. use idle partitions to set RAID 5
Using an idle device to test RAID 5 is cool. We only use one hard disk. In general, I will create a M logical partition for testing. If you have a 1g extended partition, you can have 10 logical partitions for various experiments.
Follow these steps to modify the configuration file as follows.
Use/etc/rc. d/rc. local to install the raid device, instead of/etc/fstab. If you want to use/etc/fstab, try it. This is mostly useless, but some people just like to try it on their own (just like me ).
These documents were hard to understand before, but these HOWTO have been updated and these tools have become more useful. Now, with the help of these examples, anyone who uses Linux can set a raid device. We hope this will help reduce the cost of RAID servers.
If you want to better use software RAID, use U2W SCSI controller, such as Adaptec controller or other good brands such as DPT and Mylex. You can also use the IDE controller for raid that only requires images and does not consider the speed. If you want to further use hardware RAID, several companies support Linux hardware RAID.
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