Home > Operation and Maintenance > Linux Operation and Maintenance > Introduction to lvm software under Linux - elastically scaling the size of the file system

Introduction to lvm software under Linux - elastically scaling the size of the file system

齐天大圣
Release: 2020-11-19 15:40:51
Original
1864 people have browsed it

We often encounter such a situation. As the system runs, it is found that the remaining space of a certain partition is insufficient, so the partition needs to be expanded. How to expand the capacity? A common strategy is to

  • add a new hard drive, then partition and format it to create a new usable partition.

  • Copy the previous file system contents to other partitions, and then unmount the original partition (if the original file system is mounted in the /www directory)

  • Mount the new partition to the original directory /www, and then copy the previous content to the /www directory.

Doesn’t the whole process seem quite troublesome? If the original file system space is particularly large, tens of gigabytes or even hundreds of gigabytes, then it will be a huge amount of work. In addition, the previous partition has no use now, which is also a waste!

lvm introduction

lvm logical volume is used to solve the above problems. It can easily expand the size of the file system. For lvm, there are several special nouns you need to know:

  • Physical Volume, referred to as PV: physical volume

  • Volume Group, referred to as VG: logical Volume group

  • ##Logical Volume, referred to as LV: Logical volume

  • Physical Extent, referred to as PE: (physical volume) The minimum storage that can be allocated The unit is called a PE, and the size of the PE can be specified.

For the relationship between PV, VG, and LV, you can understand it through the following figure


Introduction to lvm software under Linux - elastically scaling the size of the file system

##lvm usage process Let’s look at the lvm usage process, which is mainly divided into the following stages:

    Disk partition
  1. Use partition to create pv
  2. Create vg with pv
  3. Split lv from vg
  4. Format lv and mount it in the directory using
  5. Disk partitioning This step is the same as before, use the fdisk or gdisk tool to partition. The next step is the process of creating a pv. This step is also simple. There is a special tool pvcreate to create it. Like the pv process, the vg stage and lv stage also have specialized vgcreate and lvcreate tools. Elastic expansion and contraction of the size of the file system is achieved by adjusting the size of the lv.

In fact, the use of lvm is very simple. It mainly depends on understanding the above proper nouns. After understanding, you can apply it flexibly. Next, we will prepare several articles to introduce some commands of lvm, as well as practical demonstrations.

For more related technical articles, please visit the

linux system tutorial column!

The above is the detailed content of Introduction to lvm software under Linux - elastically scaling the size of the file system. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template