I. Some concepts about LVM
1. LVM: Logical Volume Manager, an abstraction layer built on a physical storage device that allows you to generate logical storage volumes,
Hardware-related storage settings are hidden and you don't have to stop applying or uninstalling the file system to resize the volume
Or migrate data, you can manage your partitions flexibly.
2. Physical Volume: Directly corresponds to the actual hard disk partition, can also be the entire hard disk or the created soft RAID, is the base of the LVM
This storage device.
3. Volume group: A storage pool consisting of one or more physical volumes that can create one or more logical volumes on a volume group.
4. Logical Volume: Similar to a hard disk partition in a non-LVM system, it is built on top of the volume group and is a standard block device .
A file system can be established on a logical volume.
Second, create
1. Create a physical Volume:
Pvcreate (hard disk partitions, such as:/dev/sdb1) (Convert hard disk partitions to physical volumes)
The command Pvdisplay allows you to view all the physical volume information in the system.
The physical volume you just created is not part of any volume group and cannot be used directly.
2. Create a volume group:
Vgcreate (volume group name, such as:wjt_vg) (physical volume, such as:/dev/sdb1)
(A physical volume can be either created or not created, and when physical is not created, the command can create a
Physical volumes and added to the volume group)
The command vgdisplay allows you to view all the physical volume information in the system.
3. create a logical volume in the volume Group:
Lvcreate-l (logical volume size, such as:3G) - n (logical volume name, such as:wjt_lv1) (volume group name, such as:
WJT_VG)
The command lvdisplay allows you to view all the logical volume information in the system.
4. Create the file system on the logical Volume:
Mke2fs-j (logical volumes, such as:/dev/wjt_vg/wjt_lv1)
5. mount the logical Volume:
MOUNT-T ext3 (logical volumes, such as:/dev/wjt_vg/wjt_lv1) (Mount directory, such as:/opt)
Third, removal
1. unload the logical volume umount (mount directory, such as:/opt)
2. Delete Logical volumes lvremove (logical volumes, such as:/dev/wjt_vg/wjt_lv1)
3. Deleting a volume group: vgremove (volume group, such as:/dev/wjt_gv)
4. Delete Physical volumes:pvremove (physical volumes, such as:/dev/sdb1)
Note: The sequence of steps to remove and create is reversed.
Linux system LVM Basic use