I. Introduction
LVM is short for Logical Volume Manager. It is a mechanism for managing disk partitions in Linux, LVM is a logical layer built on hard disks and partitions to improve the flexibility of disk partition management. LVM is a logical layer added between the disk partition and the file system to shield the file system from the underlying disk partition layout, provide an abstract disk volume, and create a file system on the disk volume. A physical volume (physical volume) refers to a hardware Partition or a device (such as RAID) with the same functions as a disk partition logically. It is the basic storage Logical Block of LVM, however, compared with basic physical storage media (such as partitions and disks), it contains management parameters related to LVM.
The most common hard-to-decide problem that Linux users encounter when installing the Linux operating system is how to correctly evaluate the size of each partition to allocate suitable hard disk space. When a partition space is exhausted, the solution is usually to use a symbolic link or a tool to adjust the partition size (such as PatitionMagic), but this is only a temporary solution, the problem is not fundamentally solved. With the appearance of the Logical Disk volume management function in Linux, these problems have been solved, and users can easily adjust the size of each partition without downtime.
Environment before the experiment:
There is a new GB hard disk to be mounted
Ultimate goal:
Expand the/home/capacity without affecting usage, that is, mount the GB hard disk to/home
Server version:
Procedure:
1. view the current space usage
2. view the current disk capacity
Run the fdisk-l command to check whether there is a new hard disk in the format of lvm. Note that only 8e partitions can be used to create lvm, change the file format to 8e when creating a partition.
3. view the original logical volume
4. Create a physical volume
5. view the current physical volume
The new physical volume is displayed.
6. Add a new physical volume to an existing logical volume
7. view the current logical volume
8. view the current partition status
9. Start to increase/home capacity
You can also use lvextend-l + 100% VG/dev/vg_lievedvd/lv_home
10. view the current partition status
You can see that the/home space has increased.
11. Be careful when formatting the new capacity.
12. Check the partition status. The lvm is successfully resized!