In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to create Software RAID10 on CentOS". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to create Software RAID10 on CentOS.
Yesterday, when reinstalling an old server, I found that there was a problem with the Intel hardware RAID control card, which could not identify all the hard drives, but all the hard drives could be identified during the installation of the operating system. Another problem was that the operating system was installed normally, but it could not be started after installation. For some reason, BIOS could not boot the system from the hard disk. So I plan to install the operating system on a USB disk, then boot the system from the USB disk, and make Software RAID 10 for the above 6 hard drives and mount them to the system.
Hard drives are not required to be identical for Software RAID, but hard drives of the same manufacturer, model and size are highly recommended. Why not choose RAID0, RAID1, RAID5 for RAID 10? A: RAID0 is too dangerous, the performance of RAID1 is slightly lower, and the performance of RAID5 is poor in the case of frequent writes. RAID10 seems to be the best choice for today's disk array, especially suitable for local storage system of KVM/Xen/VMware virtual machine mother machine (host) (if SAN and distributed storage are not considered).
There are 6 identical hard drives on this server, each of which is divided into a zone with a partition format of Linux software raid:
# fdisk / dev/sdaWARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u'). Command (m for help): nCommand action e extended p primary partition (1-4) pPartition number (1-4): 1First cylinder (1-91201, default 1): Using default value 1Last cylinder, + cylinders or + size {K Magazine G} (1-91201, default 91201): Using default value 91201Command (m for help): pDisk / dev/sda: 750.2 GB, 750156374016 bytes255 heads 63 sectors/track 91201 cylindersUnits = cylinders of 16065 * 8225280 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0005c259 Device Boot Start End Blocks Id System/dev/sda1 1 91201 732572001 83 LinuxCommand (m for help): tSelected partition 1Hex code (type L to list codes): fdChanged system type of partition 1 to fd (Linux raid autodetect) Command (m for help): wThe partition table has Been altered calling ioctl () to re-read partition table.Syncing disks.
Partition the remaining 5 hard drives sdc, sdd, sde, sdf, sdg, and change the partition format according to the / dev/sda partition example above:
# fdisk / dev/sdc...# fdisk / dev/sdd...# fdisk / dev/sde...# fdisk / dev/sdf...# fdisk / dev/sdg...
After the partition is complete, you can start to create a RAID, creating a raid10 on the above six partitions of the same size:
# mdadm-- create / dev/md0-v-- raid-devices=6-- level=raid10 / dev/sda1 / dev/sdc1 / dev/sdd1 / dev/sde1 / dev/sdf1 / dev/sdg1mdadm: layout defaults to n2mdadm: layout defaults to n2mdadm: chunk size defaults to 512Kmdadm: size set to 732440576Kmdadm: Defaulting to version 1.2 metadatamdadm: array / dev/md0 started.
Look at the initialization process (build) of the disk array, which can take several hours, depending on the disk size and speed:
# watch cat / proc/mdstatEvery 2.0s: cat / proc/mdstat Tue Feb 11 12:51:25 2014Personalities: [raid10] md0: active raid10 sdg1 [5] sdf1 [4] sde1 [3] sdd1 [2] sdc1 [1] sda1 [0] 2197321728 blocks super 1.2512K chunks 2 near-copies [6gamma 6] [UUUUUU] [>.] Resync = 0.2% (5826816 + 2197321728) finish=278.9min speed=130948K/secunused devices:
After the array is initialized, you can create partitions and file systems for md0 devices, and with file systems, you can mount them to the system:
# fdisk / dev/md0# mkfs.ext4 / dev/md0p1# mkdir / raid10# mount / dev/md0p1 / raid10
Modify the / etc/fstab file to mount automatically every time the system starts:
# vi / etc/fstab.../dev/md0p1 / raid10 ext4 noatime,rw 0 0
It is not a good idea to use the / dev/md0p1 device name in the / etc/fstab file above, because the device name often changes after rebooting the system because of udev, so it is best to use UUID and use the blkid command to find the UUID of the corresponding partition:
# blkid.../dev/md0p1: UUID= "093e0605-1fa2-4279-99b2-746c70b78f1b" TYPE= "ext4"
Then modify the corresponding fstab and mount it using UUID:
# vi / etc/fstab...#/dev/md0p1 / raid10 ext4 noatime,rw 0 0UUID=093e0605-1fa2-4279-99b2-746c70b78f1b / raid10 ext4 noatime,rw 0 0
Check the situation of RAID:
# mdadm-- query-- detail / dev/md0/dev/md0: Version: 1.2 Creation Time: Tue Feb 11 12:50:38 2014 Raid Level: raid10 Array Size: 2197321728 (2095.53 GiB 2250.06 GB) Used Dev Size: 732440576 (698.51 GiB 750.02 GB) Raid Devices: 6 Total Devices: 6 Persistence: Superblock is persistent Update Time: Tue Feb 11 18:48:10 2014 State: clean Active Devices: 6Working Devices: 6 Failed Devices 0 Spare Devices: 0 Layout: near=2 Chunk Size: 512K Name: local:0 (local to host local) UUID: e3044b6c:5ab972ea:8e742b70:3f766a11 Events: 70 Number Major Minor RaidDevice State 0 8 1 0 active sync / dev/sda1 1 8 33 1 active sync / dev/sdc1 2 8 49 2 active sync / dev/sdd1 3 8 65 3 active sync / dev/sde1 4 8 81 4 active sync / dev/sdf1 58 97 5 active sync / dev/sdg1 I believe you have a better understanding of "how to create Software RAID10 on CentOS", so you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.