Implement RAID5 disk array in rhel5

Source: Internet
Author: User
Original Works are allowed to be reprinted. During reprinting, please mark the article in hyperlink form
Original source, author information, and this statement. Otherwise, legal liability will be held. Http://kk5234.blog.51cto.com/1006247/416875

For raid in Linux, the disk array device can be more than three partitions in one disk, or three or more disks. This document uses several disks as an example to describe RAID 5.

Lab Description: in VMware, there is an SDA disk in the system, and six new SCSI disks are added: SDB, SDC, SDD, SDE, SDF, SDG, four of them are used as the disk array devices, one is used as the preparation (spare) disk, and the other is used as the backup. Tutorial steps: 1. Check the disk devices in the system.: 2. Create a raid and apply the mdadm command. To use this command, you must first install the mdadm package on the rhel5 installation disc. If not, install it first.. [Root @ linux5234 ~] # Mdadm -- create -- Auto = Yes/dev/md0 -- level = 5 -- raid-devices = 4 -- spare-devices = 1/dev/SD [B-f] parameter description: -- create // indicates that you want to create a raid -- Auto = Yes/dev/md0 // the newly created software disk array device is md0, the MD serial number can be 0-9 -- level = 5 // The level of the disk array, here we create RAID5 -- raid-devices // Number of disks used as the disk array -- spare-devices // Add as a preparation (spare) number of disk blocks/dev/SD [B-f] // The device used by the disk array, you can also write/dev/sdb/dev/SDC/dev/SDD/dev/SDE/dev/SDF. This command can also be abbreviated: mdadm-C/dev/md0-L5-N4-x1/dev/SD [B-f] 3. two methods are available to check whether raid is successfully created and running properly (when the disk capacity is larger, the longer the disk array is built, so it may take a long time to see the following information): Run the mdadm -- detail/dev/md0 command to view raid details: view the/proc/mdstat file, which can be a simple and clear view of RAID creation and operation: 4. format, mount, and use the created raid: [Root @ linux5234 ~] # Mkfs. ext3/dev/md0
[Root @ linux5234 ~] # Mkdir/mnt/RAID5
[Root @ linux5234 ~] # Mount/dev/md0/mnt/RAID5/check the mounting status (mounted): to check whether the newly mounted raid can be used (yes ): 5. Set boot to automatically start raid and Mount: First create the/etc/mdadm. conf configuration file: [root @ linux5234 ~] # Mdadm -- detail/dev/md0 | grep UUID>/etc/mdadm. conf the file created above must be slightly modified: [root @ linux5234 ~] # Vi/etc/mdadm. conf
Array/dev/md0 UUID = d58ed27d: 00ce5cf5: b26ed1e9: 879d0805 and then modify the/etc/fstab file to set automatic mounting upon startup: [root @ linux5234 ~] # Vi/etc/fstab
/Dev/md0/mnt/RAID5 ext3 defaults 0 0 restart the system, and you can check whether automatic mounting has been set successfully! 6. simulate a disk damage in RAID 5 and check the spare disk function (a disk damage is allowed in RAID 5. The one we set will immediately replace the damaged disk, raid reconstruction to ensure data security ):[Root @ linux5234 ~] # Mdadm -- manage/dev/md0 -- fail/dev/SDD // Use this command to set the status of the disk SDD to an error and check it again: /mnt/RAID5 can also be used normally: 7. Delete the faulty disk and add it to the new disk:Delete the damaged disk SDD first: [root @ linux5234 RAID5] # mdadm -- manage/dev/md0 -- remove/dev/SDD // Delete the damaged disk SDD from raid and add a new disk as a spare Disk: [root @ linux5234 RAID5] # mdadm -- manage/dev/md0 -- add/dev/SDG // Add a new disk sdgok and check it again: 8. How to Disable software raid:When you no longer need raid, you can use either of the following methods to disable raid:> uninstall/dev/md0, and delete or comment out the configuration in the/etc/fstab file: [root @ linux5234 ~] # Umount/dev/md0
[Root @ linux5234 ~] # Vi/etc/fstab
#/Dev/md0/mnt/RAID5 ext3 defaults 0 0> run the mdadm command to close/dev/md0 and comment out/etc/mdadm. configuration in conf: [root @ linux5234 ~] # Mdadm -- stop/dev/md0
[Root @ linux5234 ~] # Vi/etc/mdadm. conf
# Array/dev/md0 UUID = d58ed27d: 00ce5cf5: b26ed1e9: 879d0805 the above steps allow you to easily build your RAID5!

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.