Disk management-raid1 + 0 volume + LVM

Source: Internet
Author: User

Disk Management

-- Raid1 + 0 volume + LVM

Preparations

Take two disks as an example: SDB and SDC. Three primary partitions are created for each hard disk.

Sdb1 1g, sdb2 1g, sdb3 1g

Sdc1 1g, sdc2 1g, sdc3 1g

Step 1: Create sdb1, sdc1, sdb2, sdc2, sdb3, and sdc3 as raid1, md1, md2, and md3 respectively.

Step 2: Create md1, md2, and md3 as raid0 volume md0

Step 3: Use LVM volume management to create the raid0 volume md0 and create the LV logical volume storage.

 

Add two hard drive SDB and SDC

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/DE/wKiom1PszYOBju4FAADNyYa4zCM362.jpg "Title =" 1.png" style = "float: none;" alt = "wkiom1pszyobju4faadnyya4zcm362.jpg"/>

Manage Disks

View version information

[[Email protected] ~] # Uname-

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/E0/wKioL1PszpywI4bXAAB4debFyq8469.jpg "Title =" snap001.jpg "style =" float: none; "alt =" wkiol1pszpywi4bxaab4debfyq8469.jpg "/>

 

[[Email protected] ~] # Cat/etc/RedHat-release

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/DE/wKiom1PszYSgNEUtAAA-TCZyDbI828.jpg "Title =" snap002.jpg "style =" float: none; "alt =" wKiom1PszYSgNEUtAAA-TCZyDbI828.jpg "/>

 

View existing Disks

[[Email protected] ~] # Fdisk-l

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/DE/wKiom1PszYTQIEkIAAF7ERRjJaI462.jpg "Title =" snap003.jpg "style =" float: none; "alt =" wkiom1pszytqiekiaaf7er1_jai462.jpg "/>

 

Add a hard disk and use commands to make the disk take effect (if the disk does not take effect, restart the server)

[[Email protected] ~] # Cd/sys/class/scsi_host/

[[Email protected] scsi_host] # ls

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/E0/wKioL1Pszp3gHwnAAADYVHHK8Pc161.jpg "Title =" snap004.jpg "style =" float: none; "alt =" wkiol1pszp3ghwnaaadyvhhk8pc161.jpg "/>

[[Email protected] ~] # Echo "---">/sys/class/scsi_host/host0/scan

... (There are several host * files and several echo commands are executed)

[[Email protected] ~] # Echo "---">/sys/class/scsi_host/host32/scan

 

View disk status again

[[Email protected] scsi_host] # fdisk-l

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/E0/wKioL1Pszp6gKqKbAAI00WjSiN8037.jpg "Title =" snap005.jpg "style =" float: none; "alt =" wkiol1pszp6gkqkbaai00wjsin8037.jpg "/>

Partition/dev/SDB Disk

[[Email protected] _ host] # fdisk/dev/SDB

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/DE/wKiom1PszYbQVU17AAGnvEQa1jI735.jpg "Title =" snap006.jpg "style =" float: none; "alt =" wkiom1pszybqvu17aagnveqa1ji735.jpg "/>

 

Similarly, create a/dev/SDC disk partition.

[[Email protected] _ host] # fdisk/dev/SDC

View the mdadm version

[[Email protected] scsi_host] # rpm-Qi mdadm

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/E0/wKioL1PszqGB-XGTAAIuw5uXaPM443.jpg "Title =" snap007.jpg "style =" float: none; "alt =" wKioL1PszqGB-XGTAAIuw5uXaPM443.jpg "/>


Create raid1 volume

[[Email protected] _ host] # mdadm-C/dev/md1-L 1-N 2/dev/sdb1/dev/sdc1

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/DE/wKiom1PszYnQmuXeAADXAoI7O_w261.jpg "Title =" snap008.jpg "style =" float: none; "alt =" wkiom1ps1_qmuxeaadxaoi7o_w261.jpg "/>

 

Similarly, two RAID 1 volumes are created.

[[Email protected] _ host] # mdadm-C/dev/md2-L 1-N 2/dev/sdb2/dev/sdc2

[[Email protected] _ host] # mdadm-C/dev/md3-L 1-N 2/dev/sdb3/dev/sdc3

Create raid0 volume

[[Email protected] _ host] # mdadm-C/dev/md0-l 0-N 3/dev/MD {1, 2, 3}

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/DE/wKiom1PszYnC3ecVAABNGqqXnmQ313.jpg "Title =" snap009.jpg "style =" float: none; "alt =" wkiom1pszync3ecvaabngqqxnmq313.jpg "/>


 

View the log file for creating a raid volume

[[Email protected] _ host] # Cat/proc/mdstat

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/E0/wKioL1PszqbylL_fAADgOqe-ybg271.jpg "Title =" snap010.jpg "style =" float: none; "alt =" wKioL1PszqbylL_fAADgOqe-ybg271.jpg "/>

 

Use raid0 volume to create LVM logical volume

[[Email protected] scsi_host] # pvcreate/dev/md0

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/DF/wKiom1PszY3Du1pBAAAsEH0zuc8748.jpg "Title =" snap011.jpg "style =" float: none; "alt =" wkiom1pszy3du1pbaaaseh0zuc8748.jpg "/>

 

[[Email protected] scsi_host] # vgcreate vg_md/dev/md0

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/E0/wKioL1Pszqag0PXiAAApr-luRqE646.jpg "Title =" snap012.jpg "style =" float: none; "alt =" wKioL1Pszqag0PXiAAApr-luRqE646.jpg "/>

[[Email protected] scsi_host] # lvcreate-L 1G-N lv1_md vg_md

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/DF/wKiom1PszY2xqJxLAAAkTyTZdC4872.jpg "Title =" snap014.jpg "style =" float: none; "alt =" wkiom1pszy2xqjxlaaaktytzdc1_2.jpg "/>


 

View created logical volume information

[[Email protected] scsi_host] # lvdisplay/dev/vg_md/lv1_md

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/E0/wKioL1Pszqbyx5dWAAEPWZtMrF0646.jpg "Title =" snap015.jpg "style =" float: none; "alt =" wkiol1pszqbyx5dwaaepwztmrf0646.jpg "/>

Format a logical volume

[[Email protected] scsi_host] # mkfs. ext4/dev/vg_md/lv1_md

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/DF/wKiom1PszY6TjU-MAACk1XKnZ_s687.jpg "Title =" snap016.jpg "style =" float: none; "alt =" wKiom1PszY6TjU-MAACk1XKnZ_s687.jpg "/>

Create a directory, mount the logical volume to the directory, and view the mount information

[[Email protected] scsi_host] # mkdir/mdamd_lv1

[[Email protected] scsi_host] # Mount/dev/vg_md/lv1_md/mdamd_lv1

[[Email protected] scsi_host] # DF-H

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/DF/wKiom1PszZHS9RHOAAFjqMScPMI978.jpg "Title =" snap018.jpg "style =" float: none; "alt =" wkiom1pszzhs9rhoaafjqmscpmi978.jpg "/>


 

Set automatic mounting

[[Email protected] scsi_host] # vi/etc/fstab

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/E0/wKioL1PszqqzTO8bAACDfaAtxtM743.jpg "Title =" snap019.jpg "style =" float: none; "alt =" wkiol1pszqqzto8baacdfaatxtm743.jpg "/>

 

Verify whether the available disk space is 3 GB after raid1 is created

The lv1_md + lv2_md + lv3_md capacity is exactly 3 GB, and an error will be reported when the fourth one is created.

[[Email protected] scsi_host] # lvcreate-L 1G-N lv2_mdvg_md

[[Email protected] scsi_host] # lvcreate-L 1G-N lv3_mdvg_md

[[Email protected] scsi_host] # lvcreate-L 1G-N lv4_mdvg_md

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/DF/wKiom1PszZGzYIGoAAA2OSzPnhA858.jpg "Title =" snap0w.jpg "style =" float: none; "alt =" wkiom1pszzgzyigoaaa2oszpnha858.jpg "/>

 

Same as lvw.md, formatting, mounting,

[[Email protected] scsi_host] # mkfs. ext4/dev/vg_md/lv2_md

[[Email protected] scsi_host] # mkfs. ext4/dev/vg_md/lv3_md

[[Email protected] scsi_host] # mkdir/mdamd_lv2

[[Email protected] scsi_host] # mkdir/mdamd_lv3

[[Email protected] scsi_host] # Mount/dev/vg_md/lv2_md/mdamd_lv2

[[Email protected] scsi_host] # Mount/dev/vg_md/lv3_md/mdamd_lv3

[[Email protected] scsi_host] # DF-lH

 

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/E0/wKioL1PszqrwpEpbAAEJIbwr8VU146.jpg "Title =" snap021.jpg "style =" float: none; "alt =" wkiol1pszqrwpepbaaejibwr8vu146.jpg "/>

 

Set automatic mounting

[[Email protected] _ host] # vi/etc/fstab

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/DF/wKiom1PszZKQN1c5AAC_w2jIJuI798.jpg "Title =" snap022.jpg "style =" float: none; "alt =" wkiom1pszzkqn1c5aac_w2jijui798.jpg "/>

 

End lab


This article is from the "Landscape Genie" blog. For more information, please contact the author!

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.