Basic terminology for LVM
As mentioned earlier, LVM is a logical layer that is added between the disk partition and the file system to mask the underlying disk partition layout for the file system, providing an abstract disk volume, and creating a file system on the disk volume. First we discuss the following LVM terminology:
Physical storage media (the physical media): This refers to the system's storage device: The hard disk, such as:/DEV/HDA1,/DEV/SDA, etc., is the lowest layer of storage system storage unit.
Physical volume (physical volume): a physical volume refers to a hard disk partition or a device (such as RAID) that logically has the same function as a disk partition, which is the basic storage logic block of LVM, but is compared to basic physical storage media (such as partitions, disks, etc.) and contains management parameters related to LVM.
Volume group (Volume Group): LVM volume groups are similar to physical hard disks in non-LVM systems, which consist of physical volumes. You can create one or more LVM partitions (logical volumes) on a volume group, and an LVM volume group consists of one or more physical volumes.
Logical volumes (logical volume): LVM logical volumes are similar to hard disk partitions in non-LVM systems, and file systems (such as/home or/usr) can be created on top of logical volumes.
PE (physical extent): each physical volume is divided into a basic unit called PE (physical extents), with a uniquely numbered PE being the smallest unit that can be addressed by LVM. The size of the PE is configurable and defaults to 4MB.
Le (logical extent): Logical volumes are also divided into addressable basic units called LE (logical extents). In the same volume group, the size of Le is the same as the PE, and one by one corresponds.
In simple terms:
PV: is a physical partition of the disk
The physical disk partition in VG:LVM, which is PV, must be added to the VG, which can be understood as a warehouse or a few large hard disks.
LV: The logical partition from the VG
Check if the Linux system has LVM tools installed
Rpm-qa | grep LVM
Querying the system for partition information
Fdisk-l
Creating partitions
fdisk/dev/Absolute Path
command (M FOR HELP): m #### Help command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a Partition l list known partition types m print this menu n add a new partition o create a new empty dos partition table p print the partition table q quit without saving changes s create a new empty sun Disklabel t change a partition ' s system id u change display/entry units v verify The partition table w write table to disk and exit x extra functionality (experts only) command ( M FOR HELP): n ## ## creating a new partition command action e extended p primary partition (1-4) p #### Create Primary partition partition number (1-4):1 #### partition idfirst cylinder (1-65270, default 1): using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-65270, default 65270): using default value 65270command (m for help): t #### Modify the partition type command (m for help):8e #### linux lvmCommand (M FOR HELP):w #### Save Changes pvcreate /dev/xvdb1/ #### Create a new PV volume pvs #### View PV Volume Vgcreate volgroup01 /dev/xvdb1/ #### Creating a new VG volume vgs #### View VG Volume lvcreate -l 50g -n lvmserver volgroup01 #### Create Logical Volume -L Specify partition size -n specify LVM name mkfs.ext4 /dev/volgroup01/lvmserver #### Use the MKFS.EXT4 command to create a EXT4 file system on a logical volume Lvmserver mount /dev/volgroup01/lvmserver /server/ #### hangs in partition to local directory/servervi /etc/fstab #### Modify fstab Boot automatically mount Note: * fstab must fill in the correct path, once error, may not start normally .* can be mounted using the Mount command in Rc.local
LVM creation for Linux