Linux increases LV (logical volume) capacity2017-09-29-17:34:13
Personal original Blog, reproduced please indicate the source.
To view the relevant commands for a logical volume:
LVS VGS
Command:
[Email protected] ~]# VGS
VG #PV #LV #SN Attr vsize vfree
Vg_arch 1 4 0 wz--n-544.01g 0
[Email protected] ~]# PVs
PV VG Fmt Attr PSize pfree
/dev/sda2 vg_arch lvm2 a--u 544.01g 0
Command Df-h
looking at the existing disks, we found that the disk SDB has 1305 cylinders, each of which is 8225280 bytes (approximately 8M). There is a disk partition SDB1, only 650 cylinders are used, and the remaining 655 cylinders are not used.
Command Fdisk-l
create a new partition on disk SDB
command:fdisk/dev/sdb
enter p to print an existing partition (not yet partitioned)
Enter n New partition
enter p to establish the primary partition (at which point P is after n, not printed)
Enter 2 to establish a second primary partition
the partition start position can be directly carriage return, default is 651
the last position of the partition can be directly carriage return, default is 1305
Enter p to print the partition and find that a partition/DEV/SDB2 has been established, but this partition is in Linux format
because partition/DEV/SDB2 is in linux format, we need to change the system identifier for the Linux LVM format:
Enter T to change the properties of the partition
entering 2 means changing the properties of the second partition
input 8e change partition 1 for Linux LVM format
enter P print partition and find the established partition/DEV/SDB1 for Linux LVM format
input W Save partition
To make kernel read the partition table again
command:partprobe
But there was some warning about SDB, rebooting the system.
command:reboot
using Fdisk-l again to view the disk in the system found a/DEV/SDB2 partition on/DEV/SDB that already has a Linux LVM format
Create PV:
Create PV:pvcreate/dev/sdb2
View System PV:pvscan
so we're going to create a 5.02G PV
Increase VG Capacity:
added VG:vgextend vg_test/dev/sdb2
View VG:vgdisplay
This allows us to increase the vg_test by 5.02G (1284 free PE, to remember this number)
increase LV Capacity:
Increase Lv:lvresize-l +1284/dev/vg_test/lv_test (1284 is the number of free PE in VG)
View Lv:lvdisplay
so we can increase the capacity of the lv_test to 9.99G.
increase the file system capacity:
command:resize2fs/dev/vg_test/lv_test
file system Lv_test has been increased from 4.9G to 9.9G
at this point, it's done!
Learn how to reduce LV capacity and share next ~ ~
Linux increases LV (logical volume) capacity