The basic concept of 1.LVM
- Physical volume (PV): volume group can be established in the above media may be a hard disk partition, and may be hard disk itself or loop file, physical volume includes a special header, the remainder of the block is cut into a physical area.
- Volume Group (VG): a set of physical volumes collected as a snap
- Logical volume (LV): virtual partitions, the physical region consisting of
- Physical region (PE): a hard disk unit may be assigned to a logical minimum, typically 4MB
2. Disk-related operations command
- df -h to see mount points
- lvdisplay displays the current logical volume
- displays the current volume group vgdisplay
- Displays the current physical volume pvdisplay
3.LVM expansion
- fdisk -l
- fdisk -l | grep '/ dev' At this point we look to the system which is only a data disk sda
- Mount the disk in a virtual machine, and then perform the following operation
- fdisl -l | grep '/ dev' because this time they mount a piece of disk, two disks results will show sda sdb
- fdisk / dev / sdb sdb create partitions n: create a partition l: Select logical partition, if you do not first create a primary partition, and then add a logical partition, up to four disk partitions. Once created, the last to write the partition w: write to disk
- fdisk -l | grep '/ dev' View Partition = "mkfs -t ext4 / dev / sdb1 format the partition
-
pvcreate / dev / sdb1 create PV
- pvscan see where VG PV
- vgextend ubuntu-vg / dev / sdb1 expansion VG
- lvextend -L + 10G / dev / ubuntu-vg / ubuntu-lv or lvextend -l + 100% FREE / dev / ubuntu-vg / ubuntu-lv expansion LV, in accordance with a capacity to add, in accordance with a percentage of added
- resize2fs / dev / ubuntu-vg / ubuntu-lv refresh partition
- Lvdisplay whether the validation is successful if the LV Size adds to prove successful
- Do not uninstall the expansion disk, may cause data loss or system will not boot
LVM words: without using LVM software is linked to the data area at a fixed LV name is fixed, non-expansion,
If the LVM is linked to a data region is under software VG, VG may comprise a plurality of the LV, when the VG insufficient capacity when a LV, LV can then expand within a VG, VG software data path point does not change. Only data corresponding to the address to be expanded capacity