This afternoon's rh131 training lecture explains raid, an independent redundant disk matrix, which provides powerful throughput capabilities for servers. in Linux, you can use a command to learn about it, that is the main character of today-mdadm.
My virtual machine Linux system version is Redhat Enterprise Linux Server Release 5.4. After learning raid, I wrote my own learning experience and set up RAID 1 and raid 10. I am a newbie, please give your comments on the problem.
Zookeeper ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Raid1:
The concept of raid is not much said. First, create a RAID 1 and provide a spare disk. Then we have to prepare at least three partitions. We recommend that you set the size to 2 GB, (In order to set up raid 10 without wasting space) use the fdisk command to create three logical partitions with a size of 2 GB.Note: After selecting the size, you must change the ID of the partition to fd to create a raid. This is because FD corresponds to Linux raid auto, only raid can be created.
[Root @ server45 ~] # Fdisk/dev/sdathe Number of cylinders for this disk is set to 15665. there is nothing wrong with that, but this is larger than 1024, and cocould in certain setups cause problems with: 1) software that runs at boot time (e.g ., old versions of lilo) 2) booting and partitioning software from other OSS (e.g ., DOS fdisk, OS/2 fdisk) Command (M for help): T # Press T in the command line to change the idpartition number (1-12) of the partition ): 7hex code (type L to list codes): FD # change to fd
After creating the partition information, take my partition information as an example. The three partitions are/dev/sda7/dev/sda8/dev/sda12, respectively. Do not rush to format them after they are complete, the following is the time for the mdadm command to be widely used.
1. Enter partprobe/dev/SDA to re-read the partition table information.
[root@server45 ~]# partprobe /dev/sda
2. Then, use the mdadm command to combine/dev/sda7 DEV/sda8 into the raid1 matrix.
[Root @ server45 ~] # Mdadm-C/dev/md1-a yes-L 1-N 2-x/dev/sda7/dev/sda8/dev/sda12 #-l specified level-N Disk count-C create a raid-x backup disk
3. Then, format the raid1
[root@server45 ~]# mkfs -t ext3 /dev/md1
4. Create a mount directory
[root@server45 ~]# mkdir /mnt/RAID1
5. mount it
[root@server45 ~]# mount /dev/md1 /mnt/RAID1
6. To do this, raid1 is working properly. However, as a qualified administrator, you should immediately manually generate its configuration file so that it can be directly used on other hosts after being removed, the default path of the configuration file is/etc/mdadm. conf
[root@server45 ~]# mdadm -D --scan >> /etc/mdadm.conf
7. If this is the first time you generate this file, you can use>, and then use> append.
ARRAY /dev/md2 level=raid1 num-devices=2 metadata=0.90 spares=1 UUID=00a18206:7bfc15e3:84bee688:c14adb2bARRAY /dev/md3 level=raid5 num-devices=3 metadata=0.90 UUID=6d966840:efea23a8:a924a1db:2b17e710
This is the information in/etc/mdadm. conf. The system can use it to restore raid operations.
8. When you need to remove the device, first cancel the mounting, and then use the mdadm-s command to stop the operation.
[root@server45 ~]# umount /dev/md1[root@server45 ~]# mdadm -S /dev/md1
9. If you want to resume its operation, you only need to scan the configuration file again, which is very convenient.
[root@server45 ~]# mdadm -A --scan
# In addition, if you want to mount the file after it is started, you only need to edit the/etc/fstab file or append a message to it, as shown below:
Vim/etc/fstab/dev/md3/mnt/raid3 ext2 defaults 0 0 # Add one at the end
Raid10 articles:
The implementation method of raid10 is to set up raid1 first and then raid0, and set raid1 and raid0 to raid10, but note that raid1 is an image volume, that is to say, the size of raid1 consisting of two 1 GB hard disks is still 1 GB, and in the same case, raid0 is 2 GB. Therefore, if you use 1 GB of raid1 and 2 GB of raid0, the created raid 10 will be reduced to 1 GB.
1. Create two 1 GB partitions based on the preceding raid1 method. After the ID is selected, re-read the partition table.
2. Run the mdadm command to build raid0. Assume that your partition is/dev/sda9/dev/sda10.
mdadm -C /dev/md0 -a yes -l 0 -n 2 /dev/sda9 /dev/sda10
3. Format/dev/md0 as the ext3 file type.
4. Build raid10
mdadm -C /dev/md10 -a yes -l 10 -n 2 /dev/md1 /dev/md0
5. Create and attach
mkdir /mnt/RAID10mount /dev/md10 /mnt/RAID10
6. Generate the configuration file
[root@server45 ~]# mdadm -D --scan >> /etc/mdadm.conf
# Now you can use mdadm-D to view your newly created raid 10! The following is my raid10 tutorial
[root@server45 ~]# mdadm -D /dev/md10/dev/md10: Version : 0.90 Creation Time : Sat Jul 30 11:20:57 2011 Raid Level : raid10 Array Size : 987776 (964.79 MiB 1011.48 MB) Used Dev Size : 987776 (964.79 MiB 1011.48 MB) Raid Devices : 2 Total Devices : 2Preferred Minor : 10 Persistence : Superblock is persistent Update Time : Sat Jul 30 12:10:11 2011 State : clean Active Devices : 2Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Layout : near=2 Chunk Size : 64K UUID : ea103b37:a3b16c6e:6b563fa7:4294923d Events : 0.2 Number Major Minor RaidDevice State 0 9 0 0 active sync /dev/md0 1 9 2 1 active sync /dev/md2
Digress: Ma Ge said: Raid is the key for enterprises to interview Linux administrators! Be sure to master the concept and implementation of RAID. Although you have no conditions to play with hardware, you must also play with Soft Raid!