Configure LVM and RAID instances in Linux

Source: Internet
Author: User
Tags hex code
Configure LVM and RAID instances in Linux-Linux Enterprise Application-Linux server application information. For more information, see. In the example system, there are four identical SCSI hard disks:

# Fdisk-l (view system hard disk)

The first SCSI hard disk has our system partition. The other three are not partitioned.

First, we create a partition for each CSCI Hard Disk:

# Fdisk/dev/sbd
Command (m for help): new
Command action
E extended
P primary partition (1-4): p
Partition number (1-4): 1
First cylinder (1-2213, default 1 ):
Using default value 1
Last cylinder or + size or + sizeM or + sizeK (1-2213, default 2213 ):
Using default value 2213
Command (m for help): type
Selected partition 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
Command (m for help): write

The partition of the other two hard disks is the same as that of the original one.

Start creating a RAID disk array:
# Mdadm -- create/dev/md0 -- level = 5 -- raid-devices = 3/dev/sdb1/dev/sdc1/dev/sdd1

View the progress information displayed in the/proc/mdstat file when creating a disk array.
# Cat/proc/mdstat

Although the mdadm command does not require a configuration file, we recommend that you configure a configuration file. Use the following command to provide a complete configuration file

# Echo DEVICE/dev/sbd1/dev/sdc1/dev/sdd1>/etc/mdadm. conf
# Mdadm -- detail -- scan>/etc/mdadm. conf
# Cat/etc/mdadm. conf

To use the new/etc/mdadm. conf file to start the disk array during system startup, run the following command:
# Mdadm-As/dev/md0

To manually stop a disk array, run the following command:
# Mdadm-S/dev/md0

The following describes how to create a logical volume group on a RAID Disk:
# Pvcreate/dev/md0
# Vcreate LVM1/dev/md0

Check our craft and run the vgdisplay command:
# Vgdisplay LVM1

The last step is to create a logical volume in the volume group LVM1.
# Lvcreate-L 10G-n web1 LVM1
# Lvcreate-L 10G-n web2 LVM1

Continue to install the file system in the logical volume:
# Mke2fs-j/dev/LVM1/web1
# Mke2fs-j/dev/LVM1/web2
# Mkdir/web1/web2
# Mount/dev/LVM1/web1/web1
# Mount/dev/LVM1/web2/web2

To delete a device from the RAID configuration, use mdadm:
# Mdadm/dev/md0-r/dev/sdc1

Add the hard disk to the disk array:
# Mdadm/dev/md0-a/dev/sdc1

The above two commands are used to replace the faulty disk after the disk fails.
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.