[root@drone-runner-exec ~]# gdisk -l /dev/sda GPT fdisk (gdisk) version 0.8.10
Partition table scan: MBR: protective BSD: not present APM: not present GPT: present
Found valid GPT with protective MBR; using GPT. Disk /dev/sda: 62914560 sectors, 30.0 GiB Logical sector size: 512 bytes Disk identifier (GUID): E8568926-5BBE-49AB-82E8-24044A0B914E Partition table holds up to 128 entries First usable sector is 34, last usable sector is 41943006 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name 1 2048 411647 200.0 MiB EF00 EFI System Partition 2 411648 2508799 1024.0 MiB 0700 3 2508800 20969471 8.8 GiB 8E00 4 20969472 41943006 10.0 GiB 8E00 Linux LVM
[root@drone-runner-exec ~]# gdisk /dev/sda GPT fdisk (gdisk) version 0.8.10
Partition table scan: MBR: protective BSD: not present APM: not present GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p Disk /dev/sda: 62914560 sectors, 30.0 GiB Logical sector size: 512 bytes Disk identifier (GUID): E8568926-5BBE-49AB-82E8-24044A0B914E Partition table holds up to 128 entries First usable sector is 34, last usable sector is 41943006 Partitions will be aligned on 2048-sector boundaries Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name 1 2048 411647 200.0 MiB EF00 EFI System Partition 2 411648 2508799 1024.0 MiB 0700 3 2508800 20969471 8.8 GiB 8E00 4 20969472 41943006 10.0 GiB 8E00 Linux LVM
Command (? for help): n Partition number (5-128, default 5): First sector (34-2047, default = 34) or {+-}size{KMGTP}: Last sector (34-2047, default = 2047) or {+-}size{KMGTP}: Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): 8e00 Changed type of partition to 'Linux LVM'
Command (? for help): w Warning! Secondary header is placed too early on the disk! Do you want to correct this problem? (Y/N): y Have moved second header and partition table to correct location.
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/sda. Warning: The kernel is still using the old partition table. The new table will be used at the next reboot. The operation has completed successfully.
[root@drone-runner-exec ~]# gdisk /dev/sda GPT fdisk (gdisk) version 0.8.10
Partition table scan: MBR: protective BSD: not present APM: not present GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help): p Disk /dev/sda: 62914560 sectors, 30.0 GiB Logical sector size: 512 bytes Disk identifier (GUID): E8568926-5BBE-49AB-82E8-24044A0B914E Partition table holds up to 128 entries First usable sector is 34, last usable sector is 62914526 Partitions will be aligned on 2-sector boundaries Total free space is 20971520 sectors (10.0 GiB)
Number Start (sector) End (sector) Size Code Name 1 2048 411647 200.0 MiB EF00 EFI System Partition 2 411648 2508799 1024.0 MiB 0700 3 2508800 20969471 8.8 GiB 8E00 4 20969472 41943006 10.0 GiB 8E00 Linux LVM 5 34 2047 1007.0 KiB 8E00 Linux LVM
Command (? for help): d Partition number (1-5): 5
Command (? for help): p Disk /dev/sda: 62914560 sectors, 30.0 GiB Logical sector size: 512 bytes Disk identifier (GUID): E8568926-5BBE-49AB-82E8-24044A0B914E Partition table holds up to 128 entries First usable sector is 34, last usable sector is 62914526 Partitions will be aligned on 2-sector boundaries Total free space is 20973534 sectors (10.0 GiB)
Number Start (sector) End (sector) Size Code Name 1 2048 411647 200.0 MiB EF00 EFI System Partition 2 411648 2508799 1024.0 MiB 0700 3 2508800 20969471 8.8 GiB 8E00 4 20969472 41943006 10.0 GiB 8E00 Linux LVM
Command (? for help): n Partition number (5-128, default 5): First sector (34-62914526, default = 41943008) or {+-}size{KMGTP}: Last sector (41943008-62914526, default = 62914526) or {+-}size{KMGTP}: Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): 8e00 Changed type of partition to 'Linux LVM'
Command (? for help): p Disk /dev/sda: 62914560 sectors, 30.0 GiB Logical sector size: 512 bytes Disk identifier (GUID): E8568926-5BBE-49AB-82E8-24044A0B914E Partition table holds up to 128 entries First usable sector is 34, last usable sector is 62914526 Partitions will be aligned on 2-sector boundaries Total free space is 2015 sectors (1007.5 KiB)
Number Start (sector) End (sector) Size Code Name 1 2048 411647 200.0 MiB EF00 EFI System Partition 2 411648 2508799 1024.0 MiB 0700 3 2508800 20969471 8.8 GiB 8E00 4 20969472 41943006 10.0 GiB 8E00 Linux LVM 5 41943008 62914526 10.0 GiB 8E00 Linux LVM
Command (? for help): w
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING PARTITIONS!!
Do you want to proceed? (Y/N): y OK; writing new GUID partition table (GPT) to /dev/sda. Warning: The kernel is still using the old partition table. The new table will be used at the next reboot. The operation has completed successfully.
root@drone-runner-exec ~]# pvdisplay --- Physical volume --- PV Name /dev/sda3 VG Name centos_centos-template PV Size 8.80 GiB / not usable 2.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 2253 Free PE 0 Allocated PE 2253 PV UUID QltmTV-hBoU-pASF-ioB9-llMd-AVgD-o766Qw
--- Physical volume --- PV Name /dev/sda4 VG Name centos_centos-template PV Size 10.00 GiB / not usable 4.98 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 2559 Free PE 0 Allocated PE 2559 PV UUID IBn2Rz-RURW-jrbM-Ijik-LXK5-73uj-5czCPv
[root@drone-runner-exec ~]# pvdisplay --- Physical volume --- PV Name /dev/sda3 VG Name centos_centos-template PV Size 8.80 GiB / not usable 2.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 2253 Free PE 0 Allocated PE 2253 PV UUID QltmTV-hBoU-pASF-ioB9-llMd-AVgD-o766Qw
--- Physical volume --- PV Name /dev/sda4 VG Name centos_centos-template PV Size 10.00 GiB / not usable 4.98 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 2559 Free PE 0 Allocated PE 2559 PV UUID IBn2Rz-RURW-jrbM-Ijik-LXK5-73uj-5czCPv
"/dev/sda5" is a new physical volume of "<10.00 GiB" --- NEW Physical volume --- PV Name /dev/sda5 VG Name PV Size <10.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID dwGjV0-M3JC-vczv-pM25-qyH5-5pgo-BbtVGf
[root@drone-runner-exec ~]# vgdisplay --- Volume group --- VG Name centos_centos-template System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 5 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 2 Act PV 2 VG Size <18.80 GiB PE Size 4.00 MiB Total PE 4812 Alloc PE / Size 4812 / <18.80 GiB Free PE / Size 0 / 0 VG UUID JagpPX-SGkz-UurK-7pJH-UxZD-HFTh-7invRM
向 LVM 卷组中添加物理卷
1 2
[root@drone-runner-exec ~]# vgextend centos_centos-template /dev/sda5 Volume group "centos_centos-template" successfully extended
调整 LVM 卷组中逻辑卷的空间大小
1 2 3
[root@drone-runner-exec ~]# lvresize -l +100%FREE /dev/centos_centos-template/root Size of logical volume centos_centos-template/root changed from <17.80 GiB (4556 extents) to 27.79 GiB (7115 extents). Logical volume centos_centos-template/root successfully resized.