- Basic Concepts
LVM The actual physical disk data is mapped to a simple and flexible virtual logical storage view, in order to control the disk resources;
That is, the method of managing file systems and volumes is reconsidered, and an additional abstraction layer is added to the file system management, which can implement virtual partitions or dynamically establish a logical volume and change the size of the volume, allowing the file system to span functions such as disk.
Physical Volume ( PV ): Physical Volume
A hard disk partition or a device that logically has the same functionality as a hard disk partition, such as RAID ), is LVM The basic storage logic block,
Unlike basic physical storage media (such as partitions, disks, etc.), it contains LVM management parameters.
Volume Group ( VG ): Volume Group
LVM the highest level of abstraction in a layer, consisting of one or more physical volumes. You can create one or more logical volumes on a volume group.
Logical Volumes ( LV ): Logical Volume
Logical Volumes ( LV ) is established on the volume group, which is equivalent to non- LVM a partition in the system on which you can create a file system, such as /Home or / var and so on.
Physical Blocks ( PE ): Physical Extent
each physical volume is divided into equal size called PE ( Physical Extents ) is a basic unit with a unique number PE is can be LVM the smallest unit of addressing. the size of the PE is configurable and defaults to 4MB.
First, scan to see if there is LVM, as shown in the figure below, without LVM
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/92/wKiom1SGo_3xzx9pAACIKRSsW0o961.jpg "/>
So then we'll start with the LVM Dynamic Logical volume experiment.
A Creating LVM Dynamic Logical Volumes
First add 4 partitions and convert to LVM to create a physical volume
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/91/wKioL1SGpJKBBRbGAAH4fy4nFng860.jpg "/>
Write it to the kernel
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/93/wKiom1SGo_6y5STsAADeM3lMPSE974.jpg "/>
Create the partition/DEV/SDA5,/DEV/SDA6,/DEV/SDA7 as a physical volume so that LVM can recognize
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/91/wKioL1SGpJPgepKTAAC8pVv1fB4873.jpg "/>
Then scan and discover that there are 3 logical volumes/DEV/SDA5/DEV/SDA6/DEV/SDA7, which indicates that the creation was successful
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/93/wKiom1SGo__wWyB9AADyGbRjDfo261.jpg "/>
viewing logical Volume Information
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/91/wKioL1SGpJWjtVccAAKgr7CB9jg628.jpg "/>
Next, create the logical volume group Vg01,pe size of 8M and add the physical volumes/dev/sda5 and/DEV/SDA6 to the logical volume group VG01
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/93/wKiom1SGpADzlS__AAC4k_VuBjY790.jpg "/>
Viewing logical Volume Group information
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/91/wKioL1SGpJaCIgwzAAFCqBTkFcs168.jpg "/>
The logical volume LVM is created immediately following the logical volume group VG01, which is 800M in size
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/93/wKiom1SGpAGgGgSmAABPYGX2ljM482.jpg "/>
viewing logical Volume Information
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/91/wKioL1SGpJajh7lCAAEbNYnoCd0905.jpg "/>
Then format the logical volume/DEV/VG01/LVM and format it as a ext3 file system
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/91/wKioL1SGpJqQ5PgsAAIwQ536rT0730.jpg "/>
Next, create the file with LVM and mount the logical volume to/LVM by command MOUNT/DEV/VG01/LVM/LVM
It is then added to the/etc/fstab so that it is still in effect after rebooting the system
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/93/wKiom1SGpAaDzsr_AAFVoEph1BA382.jpg "/>
Make the Mount effective
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/91/wKioL1SGpJuD2qKeAAA3eydn_zk908.jpg "/>
View mount information and discover the success of the LVM mount!!!
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/91/wKioL1SGpJuB-k-QAAEef9h0uHA153.jpg "/>
- Online expansion of LVM dynamic logical volumes
To meet the need to extend the logical volume to 1300M, the previous 2 physical volumes, or 1000M of storage, are definitely not enough, so you need to add a physical volume/DEV/SDA7 to the logical volume group VG01
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/93/wKiom1SGpAfCD8BeAACd5-3_5yM362.jpg "/>
View the logical Volume group VG01 information and find nearly 1500M of storage space enough to meet 1200M storage needs
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/91/wKioL1SGpJzhX0lwAAFTzxrN6G8406.jpg "/>
After the logical volume group is extended to 1500M, the logical volume can be expanded accordingly, so the logical volume VG01 is extended to 1300M
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/93/wKiom1SGpAfip-VKAACi5JHcc18272.jpg "/>
Look at the information on the logical volume and find that VG01 is nearly 1300M.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/91/wKioL1SGpJ2zTk9VAAEh3Vourrw319.jpg "/>
Then it is known that although the logical volume has been expanded, but does not change on the file system mount, then use the command RESIZE2FS/DEV/VG01/LVM to stretch the extended logical volume onto the file system, and then view it.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/93/wKiom1SGpAqQxB9GAAMZaB8_o24173.jpg "/>
- Reduce logical volumes offline
If the storage space is found to be too large in the production ring lens, the storage space needs to be reduced to reduce waste.
- First, you need to unload the logical volume VG01
The command is UMOUNT/LVM and can be found to have been uninstalled.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/91/wKioL1SGpJ_wajNuAAEEETrbz70157.jpg "/>
2. Scan Logical Volume LVM
650) this.width=650; "Src=" http://s3.51cto.co
Simple application of LVM dynamic Logical Volume