Article title: Build a disk array under liunx (2 ). 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.
RAID1 based on kernel 2.0.35
To use raid1, 4, or 5, you must install a patch for the kernel.
Bytes.
Copy to/usr/src directory and decompress the patch:
Tar-zxvf raid0145-19981005-c-2.0.35.tz
Note that the patch will search for the/usr/src/linux-2.0.35 directory. if you install 2.0.35 source code in the directory/usr/src/linux, you need mv/usr/src/linux/usr/src/linux-2.0.35, then make a symbolic link ln-s/usr/src/linux-2.0.35/usr/src/linux
To use this patch, go to the directory/usr/src:
Patch-p0 (in my system, in some cases, the lower-case c will change to the upper-case C? Maybe after decompression ?)
Now you can re-compile the kernel. when you select multiple devices (options), you will see the options raid1, 4, and 5. the steps are as follows:
Make menuconfig (or config or xconfig)
Make clean
Make dep
Make zImage
Make modules (if you use a module)
Make modules_install
Copy the new kernel to a proper location (// or/boot) in your system ). I suggest you have a raid-free kernel and a raid-free kernel. you can modify lilo. conf to determine which kernel to start. this is not difficult at all, although it seems a little scary at first. view examples and documents of/usr/lib/lilo. (Note: it may be a directory in Slackware, not in Redhat5.1)
Check the output of dmesg │ more to confirm that the md drive has been mounted and raid0 & 1 has been registered. press cat/proc/mdstat to check if you have a new md drive. you should see 16 md drives instead of 4.
You will have to upgrade your raidtools. mdadd,/etc/mdtab, and mdcreate are old. The new tools should be raidstart,/etc/raidtab, and mkraid. at this point, the (current) document is indeed outdated. ftp://ftp.kernel.org/pub/linux/daemons/raid/alpha/raidtools-19981005-B-0.90.tar.gz
Download to/usr/local/src and
Tar-zxvf raidtools-19981005-B-0.90.tar.gz
This will generate a new directory/usr/local/src/raidtools-0.90. enter this directory as ../configure
Once again, I cannot remember whether to proceed with make and make install.
A simple method to complete RAID0 in kernel 2.0.35
Use two scsi devices/dev/sda1 and/dev/sdb1 to complete a raid0 array:
Partition/dev/sda1 and/dev/sdb1 so that they have the same block size.
Set the partition type to 0xfd. this is used to enable the new kernel to automatically identify raid at startup.
Modify the/etc/raidtab file as follows (some important information is missing in the example provided by raidtools ):
# Striping example
#/Dev/md0 using/dev/sda1 and/dev/sdb1
When you type mkraid-f/dev/md0, be sure to read the error message to clarify the direction! Cat/proc/mdstat checks the output information and determines whether the md device is properly prepared. use mke2fs-c/dev/md0 to format the new raid device. generate an installation directory (for example,/raidtest) to test whether it works.
Mount/dev/md0/raidtest
Check whether you can copy a file to/raidtest. if your hard drive device has its own LED light, you can see that both devices are working.
Restart and check whether the kernel automatically disables the raid device md0. some information will be rolled over the screen. (who knows how to use "dmesg" to read shutdown information ?)
Check whether the computer automatically identifies the raid device and/dev/md0 as a raid 0 array during the restart process. if not, check the previous steps, especially steps 2 and 4.
New method based on kernel 2.0.35 RAID 1
Use two RAID 0 (striping) devices to construct a raid1 array/dev/md2. the Two RAID 0 devices are/dev/md0 (/dev/sda1 +/dev/sdb1) and/dev/md1 (/dev/sdc1 +/dev/sdd1 ):
Follow the above steps to create/dev/md0 and/dv/md1. important information: you cannot install or create a file system on/dev/md0 and/dev/md1. this is just to test whether raid0 is working!
Modify the/etc/raidtab file as follows (some important information is missing in the example provided by raidtools ):
# Striping example
#/Dev/md0 using/dev/sda1 and/dev/sdb1
Type "mkraid-f/dev/md2" and read the error message to clarify the direction! This step will take a while because the disk needs to be synchronized (more than 39 minutes ).
Cat/proc/mdstat to check whether the md device is correctly completed.
Use mke2fs-c/dev/md2 to format the new raid device
Generate the installation directory (for example,/raidtest_mirror)
Mount/dev/md0/raidtest
Check whether you can copy files to/raidtest. if your hard disk has independent LED lights, you can find that they work simultaneously.
Add raidstart/dev/md2 to your/etc/rc. d/rc. in the s File, note that before fsck-. a good position is after swapon-. currently, the kernel cannot automatically identify raid1. the next patch will be completed (automatically identified ).
Modify/etc/fstab to install/dev/md2 to/raidtest.
/Dev/md2/raidtest ext2 defaults 1 1
Restart and check whether the kernel automatically shuts down the device md0. md1 and md2. some information will be rolled over the screen. (does anyone know how to use "dmesg" to view shutdown information ?)
Check whether the kernel automatically identifies the raid device/dev/md0 and/dev/md1 as the raid 0 array during the restart process. check whether the/dev/md2 device is a raid 1 array.
Cat/proc/mdstat check whether the md device is correctly established.
You should have a raid1 array based on RAID 0 running.
If you have any problems, you can refer to the following resources:
Linux raid Archives: http://www.linuxhq.com/lnxlists/linux-raid/
Send a message to comp. OS. linux. setup.
Search for www.dejanews.com-an archived site for newsgroup messages in the past five years.
If you don't know how it works, send an e-mail to the Linux RAID mailing list. ask the question, e-mail linux-raid@vger.rutgers.edu
In the kernel RAID list, the e-mail majordomo@vger.rutgers.edu writes subscribe linux-raid in the letter body
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