Disk management-RAID 5

Source: Internet
Author: User

Disk management-RAID 5 What is RAID 5raid Level 5 is a storage solution that combines storage performance, data security, and storage costs. It uses the Disk Striping technology. RAID 5 requires at least three hard disks. Instead of backing up the stored data, RAID 5 stores the data and the corresponding parity information on each disk that makes up RAID 5, in addition, the parity information and the corresponding data are stored on different disks. When a disk data in RAID 5 is damaged, you can use the remaining data and the corresponding parity information to restore the damaged data. RAID 5 can be understood as a compromise between RAID 0 and RAID 1. RAID 5 can provide data security protection for the system, but its security level is lower than that of the image, and the disk space utilization is higher than that of the image. RAID 5 has a Data Reading Speed similar to RAID 0, but the data writing speed is quite slow due to an additional parity information, if "Write-back cache" is used, the efficiency can be improved significantly. At the same time, because multiple pieces of data correspond to one parity information, the disk space utilization of RAID 5 is higher than that of RAID 1, and the storage cost is relatively low. 2. RAID5 demonstration Step 1: Prepare a disk [plain] [root @ serv01 ~] # Ls/dev/sdb1/dev/sdc1/dev/sdd1/dev/sdb1/dev/sdc1/dev/sdd1 Step 2 create RAID5 [plain] [root @ serv01 ~] # Mdadm -- C/dev/md5-l 5-n3/dev/sdb1/dev/sdc1/dev/sdd1 [root @ serv01 ~] # Mdadm -- create/dev/md5 -- level 5 -- raid-devices = 3/dev/sdb1/dev/sdc1/dev/sdd1 mdadm: Defaulting to version 1.2 metadata mdadm: array/dev/md5 started. [root @ serv01 ~] # Cat/proc/mdstat Personalities: [raid1] [raid0] [raid6] [raid5] [raid4] md5: active raid5 sdd1 [3] sdc1 [1] sdb1 [0] 4190208 blocks super 1.2 level 5,512 k chunk, algorithm 2 [3/3] [UUU] unused devices: <none> Step 3: Format [plain] [root @ serv01 ~] # Mkfs. ext4/dev/md5 Step 4 modify the configuration file [plain] # append the file [root @ serv01 ~] # Echo "/dev/md5/webext4 defaults 1 2">/etc/fstab # create a configuration file [root @ serv01 ~] # Mdadm -- detail -- scan>/etc/mdadm. conf [root @ serv01 ~] # Cd/web [root @ serv01 web] # ls config-2.6.32-131.0.15.el6.x86_64 initramfs-2.6.32-131.0.15.el6.x86_64.img System. map-2.6.32-131.0.15.el6.x86_64 efi lost + found vmlinuz-2.6.32-131.0.15.el6.x86_64 grub symvers-2.6.32-131.0.15.el6.x86_64.gz # View Details [root @ serv01 web] # mdadm-D/dev/md5/dev/md5: Version: 1.2 Creation Time: thu Aug 119:49:56 2013 Raid Level: raid5 Array Size: 4190208 (4.00 GiB 4.29 GB) Used Dev Size: 2095104 (2046.34 MiB 2145.39 MB) Raid Devices: 3 Total Devices: 3 Persistence: Superblock is persistent Update Time: Thu Aug 1 20: 24: 482013 State: clean Active Devices: 3 Working Devices: 3 Failed Devices: 0 Spare Devices: 0 Layout: left-blank Ric Chunk Size: 512 K Name: serv01.host.com: 5 (localto host serv01.host.com) UUID: a738b211: 987ef2b2: e6ce9eb3: 58724db1 Event S: 20 Number Major Minor RaidDevice State 0 8 17 0 active sync/dev/sdb1 1 1 8 33 1 active sync/dev/sdc1 3 8 49 2 active sync/dev/sdd1 Step 5 simulate Disk [plain] # cancel partition o [root @ serv01 web] # fdisk/dev/sdb WARNING: DOS-compatible mode is deprecated. it's stronugly recommended to switch off the mode (command 'C') and change display units to sectors (command 'U '). command (m for help): o Building a new DOS disk Label with diskidentifier 0xc785ce7b. changes will remain in memory only, untilyou decide to write them. after that, of course, the previous contentwon't be recoverable. warning: invalid flag 0x0000 of partitiontable 4 will be corrected by w (rite) WARNING: DOS-compatible mode is deprecated. it's stronugly recommended to switch off the mode (command 'C') and change display units to sectors (command' U'). Command (m for help): w The partition table has been altered! Calling ioctl () to re-read partition table. WARNING: Re-reading the partition tablefailed with error 16: Device or resource busy. the kernel still uses the old table. thenew table will be used at the next reboot or after you runpartprobe (8) or kpartx (8) Syncing disks. # view [root @ serv01 web] # mdadm-D/dev/md5/dev/md5: Version: 1.2 Creation Time: Thu Aug 11:49:56 2013 Raid Level: raid5 Array Size: 4190208 (4.00 GiB 4.29 GB) Used Dev Size: 2095104 (2046.34 MiB 2145.39 MB) Raid Devices: 3 Total Devices: 3 Persistence: Superblock is persistent Update Time: thu Aug 1 20: 25: 162013 State: clean Active Devices: 3 Working Devices: 3 Failed Devices: 0 Spare Devices: 0 Layout: left-blank Ric Chunk Size: 512 K Name: serv01.host.com: 5 (localto host serv01.host.com) UUID: a738b211: 98 7ef2b2: e6ce9eb3: 58724db1 Events: 20 Number Major Minor RaidDevice State 0 8 17 0 active sync/dev/sdb1 1 1 8 33 1 active sync/dev/sdc1 3 8 49 2 active sync/dev/sdd1 # restart [root @ serv01 web] # reboot # partition/dev/sde [root @ serv01 web] # fdisk/dev/sde WARNING: DOS-compatible mode is deprecated. it's stronugly recommended to switch off the mode (command 'C') and change display units to sectors (command 'U '). Command (m for help): p Disk/dev/sde: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065*512 = 8225280 bytes Sector size (logical/physical): 512 bytes/512 bytes I/O size (minimum/optimal ): 512 bytes/512 bytes Disk identifier: 0x26eb36f1 Device Boot Start End Blocks Id System Command (m for help): n Command action e extended p primary partition (1-4) P Partition number (1-4): 1 First cylinder (1-261, default 1): Using default value 1 Last cylinder, + cylinders or + size {K, M, g} (1-261, default 261): Using default value 261 Command (m for help): w The partition table has been altered! Calling ioctl () to re-read partition table. syncing disks. step 6 add a disk [plain] [root @ serv01 web] # mdadm -- manage/dev/md5 -- add/dev/sde1 mdadm: added/dev/sde1 [root @ serv01 web] # cat/proc/mdstat Personalities: [raid6] [raid5] [raid4] md5: active raid5 sde1 [4] sdc1 [1] sdd1 [3] 4190208 blocks super 1.2 level 5,512 k chunk, algorithm 2 [3/2] [_ UU] [=====================>...] rediscovery = 85.8% (1800064/20951 04) finish = 0.0 min speed = 200007 K/sec unused devices: <none> # View Details again [root @ serv01 web] # mdadm -- D/dev/md5 mdadm: unrecognized option '-- d' Usage: mdadm -- help forhelp [root @ serv01 web] # mdadm-D/dev/md5/dev/md5: Version: 1.2 Creation Time: thu Aug 119:49:56 2013 Raid Level: raid5 Array Size: 4190208 (4.00 GiB 4.29 GB) Used Dev Size: 2095104 (2046.34 MiB 2145.39 MB) Raid Devices: 3 Total D Evices: 3 Persistence: Superblock is persistent Update Time: Thu Aug 1 20: 28: 292013 State: clean Active Devices: 3 Working Devices: 3 Failed Devices: 0 Spare Devices: 0 Layout: left-direction Ric Chunk Size: 512 K Name: serv01.host.com: 5 (localto host serv01.host.com) UUID: a738b211: 987ef2b2: e6ce9eb3: 58724db1 Events: 45 Number Major Minor RaidDevice State 4 8 65 0 active sync/dev/sde1 1 8 33 1 active sync/dev/sdc1 3 8 49 2 active sync/dev/sdd1 # login after restart root @ serv01 web] # reboot [root @ larrywen disk] # ssh 192.168.1.11 root@192.168.1.11' s password: last login: Thu Aug 1 20:26:07 2013 from 192.168.1.1 [root @ serv01 ~] # Cat/proc/mdstat Personalities: [raid6] [raid5] [raid4] md5: active raid5 sdc1 [1] sde1 [4] sdd1 [3] 4190208 blocks super 1.2 level 5,512 k chunk, algorithm 2 [3/3] [UUU] unused devices: <none>

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.