Linux LVM Logical Volume Learning Notes

Source: Internet
Author: User

Disk labels, such as/dev/mapper/volgroup-lv_root,/dev/mapper/volgroup-lv_home, and so on, are often encountered in production environments, which are actually logical volumes (virtual disks)

Today just learned this piece, summed up a bit to share to everyone, so as not to encounter this logical volume management encountered problems.

First say a few nouns:

LVM (Logical Volume Manager), logical Volume Manager

PV (physical Volume), physical volume

VG (Volume Group), Volume group

PE (physical Extend), logical volume, default size 4M, up to 65,534 PE per volume group, to increase the capacity of the logical volume, increasing the PE size

LG (Logical Group), logical group

Is the analysis of the above several concepts (the picture is ugly, make a look at it):

As can be seen, the logical volume is the physical volume through the LVM virtual out, the advantage is the ability to adjust the capacity of the file system flexibly, that is, the logical volume can be increased capacity on demand.

Here's how:

1. Add HDD SDB to the machine

2, I here will be the physical disk SDB zoned a partition SDB1

FDISK/DEV/SDB, specifically ask Baidu Bar

3. Use parted to set the disk partition flag to (8e)

4. View Disk

5. Create physical volume related commands: Pvcreate pvscan pvdisplay Pvremove

Pvcreate/dev/sdb1

6. Create Volume group related commands: Vgcreate vgscan vgdisplay vgextend vgreduce vgchange vgremove

VGCREATE/DEV/SDB1 Newvolgroup

7. Create logical Volume related commands: Lvcreate lvscan lvdisplay lvextend lvreduce lvremove lvresize

Lvcreate–l 3842–n Lv_data Newvolgroup

-L is the specified number of PE, the above command is divided into 3,842 pe from the Newvolgroup to Lv_data (3842*4m)

8, after the format of the mount, such as a series of commands, as follows

Mkfs.ext4/dev/mapper/newvolgroup-lv_data

Mkdir/mnt/data

Mount/dev/mapper/newvolgroup-lv_data/mnt/data

Finally, don't forget to change the/etc/fstab file to add the disk information

Linux LVM Logical Volume Learning Notes

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.