RedHatLinux manual creation of RAID and LVM partitions

Source: Internet
Author: User
Article Title: RedHatLinux manual creation of RAID and LVM partitions. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   Create a RAID (RAID5 is used as an example)
  
1. First, we need to create a new disk partition.
  
# Fdisk/dev/hda
  
Create 3 MB partitions (hda7, hda8, hda9), enter t under the fdisk command, select the created partition, and enter fd, convert the three created partitions to the fd format. Enter w to save and exit
  
2. Activate the created Partition
  
# Partprobe
  
3. Load the three partitions to md0. l5 indicates that the RAID level is RAID 5, and n3 indicates that there are three partitions.
  
# Mdam? C/dev/md0? L5? N3/dev/had {7, 8, 9}
  
4. Check the created RAID partition.
  
# Cat/proc/mstat
  
5. format the md0 partition into the ext3 format, mount the RAID partition to the directory, and modify the fstab table.
  
# Mkfs. ext3/dev/md0
# Mount/dev/md0/pot
# Vi/etc/fstab
  
In this way, a RAID 5 disk partition is successfully created.
  
   Create LVM
  
1. First, we need to create a new disk partition.
  
# Fdisk/dev/had
  
Create two MB partitions (hda10, hda11), enter t under the fdisk command, select the created partition, enter 8e, and convert the created two partitions to 8e format. Enter w to save and exit
  
2. Activate the created Partition
  
# Partprobe
  
3. Create a pv
  
# Pvcreate/dev/had {10, 11}
# View pv through pvdisplay
  
4. Load the partition to the vg volume group. vg0 indicates the volume group name, And vg0 indicates that the total volume group space is 1000 MB.
  
# Vgcreate vg0/dev/had {10, 11}
# Vgdisplay view vg volume group
  
5. When creating an lv partition, MB indicates the partition size, lv0 indicates the lv partition name, And vg0 indicates the name of the volume group. At this time, a MB lvm partition is created, MB remaining for the vg0 volume group
  
# Lvcreate? L 800 M? Nlv0 vg0
# Lvdisplay viewing lv partitions
  
6. format the lv partition into the ext3 format.
  
# Mkfs. ext3/dev/vg0/lv0
  
7. mount the LVM partition to the directory and modify the fstab table.
  
# Mount/dev/vg0/lv0/lvm
# Vi/etc/fstab
  
8. Expansion (lv) We just created a MB lvm partition. The following operations should be performed to expand the partition:
  
# Lvextend? L + 100 M/dev/vg0/lv0
# Ext2online/dev/vg0/lv0 Dynamic Scaling
  
At this point, we have increased the space by MB to the lv0 partition, And the vg0 volume group still has MB space left. If we think the space is insufficient, we need to expand it, when the vg0 volume group does not have enough space, we need to expand the vg0 volume group and then expand the lv partition.
  
1. Create a MB partition (hda12), enter t under the fdisk command, select the created partition, and enter 8e to convert the created partition to 8e format. Enter w to save and exit
  
# Fdisk/dev/had
  
2. Activate the created Partition
  
# Partprobe
  
3. Create a pv
  
# Pvcreate/dev/had12
  
4. Add hda12 to the vg0 volume group. The total size of the vg0 volume group is 1500 MB.
  
# Vgextend vg0/dev/hda12
  
5. dynamically expand lv0 partitions to increase the space by MB
  
# Lvextend? L + 500 M/dev/vg0/lv0
# Ext2online/dev/vg0/lv0
  
In this case, the total size of the LVM partition should be 800 M + 100 M + 500 M = 1400 M.

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.