Logical Volume management and logical volume expansion of Linux
LVM is the short name for logical volume management (Logical Volume Manager), an abstraction layer built on physical storage devices that allows you to generate logical storage volumes, and provides greater flexibility in managing the direct use of physical storage.
LVM will store virtualization, use logical volumes, you will not be limited to the size of the physical disk, in addition, hardware-related storage settings are hidden, you can not stop the application or uninstall the file system to adjust the volume size or data migration. This will reduce the cost of operation.
LVM has the following advantages over the direct use of physical storage:
1. Flexible capacity.
When using logical volumes, the file system can be extended to multiple disks, and you can aggregate multiple disks or partitions into a single logical volume.
2. A scalable storage pool.
You can use simple commands to enlarge or reduce the size of the logical volume without reformatting or partitioning the disk device.
3. Online redistribution of data.
You can move data online, and the data can be redistributed on disk. For example, you can replace hot-swappable disks online.
4. Convenient naming of equipment
A logical volume can start all names in a way that you find convenient.
5. Disk is striped.
You can generate a logical disk whose data can be stored on 2 or more disks. This can significantly improve data throughput.
6. Image Volume
Logical volumes provide a convenient way to image your data.
7. Volume Snapshots
With logical volumes, you can get device snapshots that are used for consistent backup or test data update effects without impacting real data.
Add a hard disk to the settings of the virtual machine
Enter terminal, input fdisk-l can see the newly added HDD SDC
FDISK/DEV/SDC to partition the hard disk, establish SDC1
Create a physical volume/DEV/SDC1
Pvdislay can see the physical volume created /DEV/SDC1
Vgcreate Creating a logical Volume Group
Vgdisplay Viewing a created volume group
Lvcreate Creating a logical Volume LogVolume001
MKFS.EXT4 initializing logical volumes
Writes mount information to Fstab
Mount-a perform mount input df-h You can see that it's already hung up.
Logical Volume Expansion
Add a hard drive to the virtual machine
Enter Fdisk to see the new hard drive as SDD
at this point, the same operation as before is performed to create SDD1
re-create the physical volume /dev/sdd1
Vgextend Add /dev/sdd1 This physical volume to the /dev/mapper/vg_oracle01 Volume Group
Lvextend size is 1G extended /dev/mapper/vg_oracle01-lv_root
Execute the RESIZE2FS command to refresh the logical volume size
You can see that the size of this logical volume has increased by 1G
Linux Logical Volume (LVM) management and logical volume partitioning