RAID5 system architecture and resizing

Source: Internet
Author: User
Tags hex code
Add four hard disks devsab, devsdc, devsdd, and devsde to the virtual machine. First, perform the original operations on the hard disk (the operations on the four hard disks are the same) [root @ Redhat ~] # Fdiskdevsd [B, c, d, e] Command (mforhelp): nCommandactioneextendedpprimarypartition (1-4) pPartiti

Add four hard disks to the Virtual Machine

/Dev/sab,/dev/sdc,/dev/sDd,/Dev/sde

First, the original operations on the hard disk (the operations on the four hard disks are the same)

[Root @ REdHat ~] #Fdisk/Dev/sd [B, c, d, e] // partition the hard disk

Command (m for help): n

Command action

EExTended

P primary partition (1-4)

P

Partition number (1-4): 1

First cylinder (1-261, default 1): 1

Last cylinder or + size or + sizeM or + sizeK (1-261, default 261 ):

Using default value 261

Command (m for help): t

Selected partition 1

Hex code (type L to list codes): fd // The type of the frozen hard disk is raId

Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): wq

Ii. RAID5

[Root @ Redhat ~] # Mdadm -- create/dev/md0 -- level = 5 -- raid-device = 3-c 128/dev/sdb1/dev/sdc1/dev/sdd1 // three hard disks are created. RAID5

3. Create LVM

[Root @ Redhat ~] # Pvcreate/dev/md0 // create PE

[Root @ Redhat ~] # Vgcreate vg0/dev/md0 // create VG

[Root @ Redhat ~] # Lvcreate-l1023-n ethnicity vg0 // create a LV

[Root @ Redhat ~] #Mkfs. Ext3/dev/md0 // format

[Root @ Redhat ~] #Mkdir/Data

[Root @ Redhat ~] # Mount/dev/vg0/ethnicity/data/

[Root @ Redhat ~] #Df-H

Filesystem Size USedAvail Use % Mounted on

/Dev/mapper/VolGroup00-LogVol00

20G 6.0G 13G 32%/

/Dev/sda1 104 M 21 M 78 M 21%/boot

Tmpfs 111 M 0 111 M 0%/dev/shm

None 111 M 107 k 111 M 1%/var/lib/xenstored

/Dev/mapper/vg0-ethnicity

4.3G 76 M 4.0G 2%/data

Iv. LVM resizing

[Root @ Redhat ~] #Umount/Data/

[Root @ Redhat ~] # Mdadm/dev/md0-a/dev/sde1 // Add a hard disk to RAID

[Root @ Redhat ~] # Mdadm -- grow/dev/md0 -- raid-devices = 4 // set the number of hard disks

[Root @ Redhat ~] # PvResize/Dev/md0

[Root @ Redhat ~] # Lvresize-l + 512/dev/vg0/ethnicity // resize based on the size of the attached hard disk

[Root @ Redhat ~] # Resize2fs/dev/vg0/ethnicity

Resize2fs 1.39 (29-May-2006)

Please run 'e2Fsck-F/dev/vg0/ethnicity 'first.

[Root @ Redhat ~] #E2fsck-F/dev/vg0/ethnicity

[Root @ Redhat ~] # Resize2fs/dev/vg0/ethnicity

[Root @ Redhat ~] # Mount/dev/vg0/ethnicity/data/

[Root @ Redhat ~] # Df-H

Filesystem Size Used Avail Use % Mounted on

/Dev/mapper/VolGroup00-LogVol00

20G 6.0G 13G 32%/

/Dev/sda1 104 M 21 M 78 M 21%/boot

Tmpfs 111 M 0 111 M 0%/dev/shm

None 111 M 107 k 111 M 1%/var/lib/xenstored

/Dev/mapper/vg0-ethnicity

6.4G 76 M 6.1G 2%/data

In this way, the small instance is successful.

The following are the notes for several operations:

1. Export the partition status of the hard disk

Sfdisk-D/dev/sdb> disk. out

2. Import the partition status to another hard disk.

Sfdisk/dev/sde

3. view the mdadm status

Cat/Proc/mdStat

Mdadm -- detail/dev/md0

4. LVM Deletion

Umount/data

Lvremove/dev/vg0/ethnicity

Vgremove vg0

Pvremove/dev/md0

5. Delete RAID

Mdadm/dev/md0? Fail/dev/sd [B, c, d, e] 1? Remove/dev/sdb [B, c, d, e] 1

6. Stop RAID

Mdadm? Stop/dev/md0

7. Clear the RAID information in the disk (partition) super block.

Mdadm -- misc? Zero-SuPerblock/dev/sd [B, c, d, e] 1

Conclusion: take notes and remember to practice more.

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.