Advanced hard disk management RAID1 + 0 solution under CentOS7.0

Source: Internet
Author: User
RAID + LVM management mode frequently used by enterprises: used software: VMwareWorkstation10 system environment: [root @ localhost ~] # Cat/etc/centos-releaseCentOSLinuxrelease7.0.1406 (Core) [root @ localhost ~] # Rpm-qimdadmN

The establishment of RAID + LVM management modes frequently used by enterprises:

Software used: VMware Workstation 10

System environment:

[Root @ localhost ~] # Cat/etc/centos-release

CentOSLinux release 7.0.1406 (Core)

[Root @ localhost ~] # Rpm-qi mdadm

Name: mdadm

Version: 3.2.6

Introduction to RAID 1 + 0 Solutions

Perform mirror on the disk first, and then strip the entire mirror Group. for example, eight disks need to be divided into four base groups, with two disks in each base group. raid1 and RAID 0 for each base group, four things take effect.

Therefore:

Allow all disks in the disk base group to be damaged, but do not allow all disks in the same base group to be damaged at the same time.

Advantage: data security is good. as long as two hard disks on one disk are damaged at the same time, no problem occurs, you can continue to run data. Fast data recovery.

Disadvantage: write performance is slightly worse than RAID 0 + 1 (same read performance)

 

My ideas

The newly added hard disks are divided into four 1G areas, namely 1, 2, 3, and 5.

Convert each two to a RAID 1 volume/dev/md {1, 2}

Convert the two RAID 1 volumes into a RAID 0 volume/dev/md0

Convert RAID 0 to pv and vg

Then create your own space through lv

This space is RAID 1 + 0.

 

 

Detailed implementation process

 

 

Here we add a hard disk 2 for the experiment.

We do not want to restart to read the newly added hard disk. we enter the following command to scan

[Root @ localhost ~] # Echo "---">/sys/class/scsi_host/host0/scan

[Root @ localhost ~] # Echo "---">/sys/class/scsi_host/host1/scan

[Root @ localhost ~] # Echo "---">/sys/class/scsi_host/host2/scan

[Root @ localhost ~] # Fdisk-l

Disk/dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1*512 = 512 bytes

Sectorsize (logical/physical): 512 bytes/512 bytes

I/Osize (minimum/optimal): 512 bytes/512 bytes

Newly added sdb discovered

 

The following describes the specific experiment process.

# Fdisk/dev/sdb

Command (m for help): n

Partitiontype:

P primary (0 primary, 0 extended, 4 free)

E extended

Select (default p ):

Usingdefault response p

Partitionnumber (1-4, default 1 ):

Firstsector (2048-41943039, default 2048 ):

Usingdefault value 2048

Lastsector, + sectors or + size {K, M, G} (2048-41943039, default 41943039): + 1G

Partition1 of type Linux and of size 1 GiB is set

Command (m for help): n

Partitiontype:

P primary (1 primary, 0 extended, 3 free)

E extended

Select (default p ):

Usingdefault response p

Partitionnumber (2-4, default 2 ):

Firstsector (2099200-41943039, default 2099200 ):

Usingdefault value 2099200

Lastsector, + sectors or + size {K, M, G} (2099200-41943039, default 41943039): + 1G

Partition2 of type Linux and of size 1 GiB is set

Command (m for help): n

Partitiontype:

P primary (2 primary, 0 extended, 2 free)

E extended

Select (default p ):

Usingdefault response p

Partitionnumber (3, 4, default 3 ):

Firstsector (4196352-41943039, default 4196352 ):

Usingdefault value 4196352

Lastsector, + sectors or + size {K, M, G} (4196352-41943039, default 41943039): + 1G

Partition3 of type Linux and of size 1 GiB is set

Command (m for help): n

Partitiontype:

P primary (3 primary, 0 extended, 1 free)

E extended

Select (default e ):

Usingdefault response e

Selectedpartition 4

Firstsector (6293504-41943039, default 6293504 ):

Usingdefault value 6293504

Lastsector, + sectors or + size {K, M, G} (6293504-41943039, default 41943039 ):

Usingdefault value 41943039

Partition4 of type Extended and of size 17 GiB is set

Allocate all the remaining space to the extended area, and then divide the range. use the l command to define the logical disk area.

Then, the interval number starts from 5 and then is added.

Command (m for help): n

Allprimary partitions are in use

Addinglogical partition 5

Firstsector (6295552-41943039, default 6295552 ):

Usingdefault value 6295552

Lastsector, + sectors or + size {K, M, G} (6295552-41943039, default 41943039): + 1G

Partition5 of type Linux and of size 1 GiB is set

Command (m for help): p

 

Disk/dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

Units = sectors of 1*512 = 512 bytes

Sectorsize (logical/physical): 512 bytes/512 bytes

I/Osize (minimum/optimal): 512 bytes/512 bytes

Disklabel type: dos

Diskidentifier: 0x8e9a9326

 

Device Boot Start End Blocks Id System

/Dev/sdb1 2048 2099199 1048576 83 Linux

/Dev/sdb2 2099200 4196351 1048576 83 Linux

/Dev/sdb3 4196352 6293503 1048576 83 Linux

/Dev/sdb4 6293504 41943039 17824768 5 Extended

/Dev/sdb5 6295552 8392703 1048576 83 Linux

/Dev/sdb6 8394752 10491903 1048576 83 Linux

[Root @ localhost ~] # Mdadm-C/dev/md1-a yes-l 1-n 2/dev/sdb}

Mdadm: Note: this array has metadata at the start and

May not be suitable as a boot device. If you plan

Store'/boot' on this device please ensurethat

Your boot-loader understands md/v1.xmetadata, or use

-- Metadatabase = 0.90

Continuecreating array?

Continuecreating array? (Y/n) y

Mdadm: Defaulting to version 1.2 metadata

Mdadm: array/dev/md1 started.

[Root @ localhost ~] # Mdadm-C/dev/md2-a yes-l 1-n 2/dev/sdb {3, 5}

Mdadm: Note: this array has metadata at the start and

May not be suitable as a boot device. If you plan

Store'/boot' on this device please ensurethat

Your boot-loader understands md/v1.xmetadata, or use

-- Metadatabase = 0.90

Continuecreating array?

Continuecreating array? (Y/n) y

Mdadm: Defaulting to version 1.2 metadata

Mdadm: array/dev/md2 started.

[Root @ localhost ~] # Mdadm-C/dev/md0-a yes-l 1-n 2/dev/md {1, 2} (convert RAID1 to RAID0)

Mdadm: Note: this array has metadata at the start and

May not be suitable as a boot device. If you plan

Store'/boot' on this device please ensurethat

Your boot-loader understands md/v1.xmetadata, or use

-- Metadatabase = 0.90

Continuecreating array?

Continuecreating array? (Y/n) y

Mdadm: Defaulting to version 1.2 metadata

Mdadm: array/dev/md0 started.

[Root @ localhost ~] # Pvcreate/dev/md0 (change PV)

Physical volume "/dev/md0" successfully created

[Root @ localhost ~] # Vgcreate first/dev/md0 (change VG)

Volume group "first" successfullycreated

[Root @ localhost ~] # Lvcreate-L 1G-n data1 first

Volume group "first" hasinsufficient free space (255 extents): 256 required.

[Root @ localhost ~] # Lvcreate-L + 500M-n data1 first (size of the desired region)

Logical volume "data1" created

 

[Root @ localhost ~] # Mkfs. ext4/dev/first/data1 (format)

Mke2fs1.42.9 (28-Dec-2013)

Filesystemlabel =

OStype: Linux

Blocksize = 1024 (log = 0)

Fragmentsize = 1024 (log = 0)

Stride = 0 blocks, Stripe width = 0 blocks

128016 inodes, 512000 blocks

25600 blocks (5.00%) reserved for the super user

Firstdata block = 1

Maximumfilesystem blocks = 34078720

63 block groups

8192 blocks per group, 8192 fragments per group

2032 inodes per group

Superblockbackups stored on blocks:

8193,245 77, 40961,573 45, 221185,401

 

Allocatinggroup tables: done

Writinginode tables: done

Creatingjournal (8192 blocks): done

Writingsuperblocks and filesystem accounting information: done

 

[Root @ localhost ~] # Mkdir/lvm1

[Root @ localhost ~] # Mount/dev/first/data1/lvm1

[Root @ localhost ~] # Cd/lvm1

[Root @ localhostlvm1] # ll

Total12

Drwx ------ 2 root 12288 Aug 12 21:21 lost + found

After mounting, you can use the new space.

For example, 20 hard disks

RAID 1 + 0, a total of 10 strip, each strip 2 hard disks for MIRROR, if one hard disk is broken, it does not matter, the other 19 hard disks need to work at the same time, as long as it is not bad in a MIRROR, it will be okay.

We recommend that you use RAID 1 + 0 with a high security factor to reduce the performance ).

Background:

If you have any mistakes, please correct them.

This article is from the "Zhang Fan-IT's fantasy drifting" blog, please be sure to keep this source http://chawan.blog.51cto.com/9179874/1540190

Related Article

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.