LVM Cognition and expansion operation

Source: Internet
Author: User

After the last "how the Linux system migrated to the LVM disk," The response is good, nearly 300 of the traffic. This time I want to write something, mainly about "LVM cognition and expansion operation." Because most of the online is not accurate, maybe the author also does not have a real server can do experiments, and then I am more fortunate to work with IDC, so this article wants to bring you a little help!

Environmental background introduction, Beijing Peak Bird Network Technology Co., Ltd. has more than one server. Now in order to deploy the OPENVZ environment, a large hen in the room to my operation and maintenance, mainly to install and deploy. The operating system chooses "CentOS6.8" (more stable and supports OpenVZ), SSD disk size is about 250G.

However, after the deployment of LVM, the business is quite smooth. The original size is not enough to continue to maintain business, in order to meet the normal operation of the business. I need to do the LVM expansion.

First, the preparation of knowledge: 1, what is LVM?

LVM is a Logical Volume Manager ( Logical Volume Management ) abbreviated, it consists of the Heinz Mauelshagen in the Linux 2.4 implemented on the kernel. LVM Sets the partition of one or more hard disks logically, equivalent to a large hard disk to use, when the hard disk space is not enough to use, you can continue to add the partition of the other hard disk, so as to achieve dynamic management of disk space, There is a lot of flexibility with respect to normal disk partitioning.

compared to traditional disks and partitions,LVMprovides a higher level of disk storage for your computer. It makes it easier for system administrators to allocate storage space for apps and users. In theLVMmanaged storage volumes can be resized and removed as needed(file System Tools may need to be upgraded). LVMalso allows storage volumes to be managed by user group, allowing administrators to use more intuitive names(as"Sales ",' development ')Replace Physical disk name(as' SDA ',' SDB ')to identify the storage volume.

The general disk starts with an SD * (and of course, the HD that represents HHD),/DEV/SDA represents the first fast physical disk (possibly 500G, 1T, or even 3T), and/dev/sdb adds a second fast disk to the server on behalf of the administrator ... The server knowledge of the disk interface as the limit. At the same time/dev/sda1 represents the first partition of the disk (which can be 1G, 1T, 794M is possible)/dev/sda2 represents the second partition of the first disk.

here we find a picture and explain: We have four fast disks ... It is also a partition (LVM is not as large as raid size, LVM can be different for each partition)!. This way we have the PV Physical Volume (Physical volume)(for LVM). Furthermore, we combine all PV physical volumes (physical volume) together as VG volume groups (volume Group) (The LVM Logical Volume (logical volume) is a set of groups that can have multiple groups). , the group is finally assigned to more than one partition (this is LVM, because LVM is assigned by the VG, so LVM can also be increased or decreased). This is the general explanation of LVM, see more: Https://en.wikipedia.org/wiki/Logical_volume_management

2, the advantages and disadvantages of LVM?

Logical Volume Management (Logical Volume management,LVM) for a large number of storage devices in your computer (Mass Storage Devices) provides a more resilient way to partition your hard disk . It is an abstraction of storage technology that is implemented in a way that differs depending on the operating system. Basically, it is the addition of a logic layer between the driver and the operating system to facilitate system management of the hard disk partitioning system.

Advantages: safe and convenient.

cons: to meet the above "Safe", high finished product.

here, Explain a misunderstanding. Many people say LVM no raid so safe. In fact, because of the LVM I didn't really understand, I did the experiment. LVM can let raid PV vg finally made LVM LVM Higher labor costs are required.

Second, LVM expansion combat:

Note that in order to save reader time. The LVM build process has been removed (including adding disk partitions, adding PV, etc.)

3, the addition of VG in LVM

Vgextend <vgdisplay vgname> < pvcreate/dev/sd disk >

Note: Here I draw it in red. In the addition of VG is the use of "vgextend" command, online someone said to use the "-add" parameter, but I practice it is not so, red for the wrong demonstration. Yellow Right

4. Process inspection in LVM

These are the results of the Vgs=vgdisplay Volume group (Volume group and the Lvs=lvdisplay logical LVM Volume (logical Volume) , respectively.

5. The disk "RESIZE2FS" redistribution in LVM

RESIZE2FS </dev/mapper/vg-lvm> <size>

A lot of people have died here. Note that even if the LVM is established, it is not too early to be happy. The Linux system does not recognize the full size of the space, "Partprobe" or "reboot" are not valid. Be sure to resize2fs the size of the redistribution.

LVM Cognition and expansion operation

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.