In the example system, there are four identical SCSI hard disks: # fdisk-l (View system hard disks) 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/sbdCommand (mforhelp): newCommandactioneextendedpprimaryp there are four identical SCSI hard disks on the system in our example:
# 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, default2213 ):
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.