Using Parted Command to Expand LVM

parted (GNU parted) 3.7
Linux kali 6.19.14+kali-amd64

/dev/sda 60G --> 100G
/dev/mapper/kali--vg-root 54G --> 94G

  1. Check filesystem and disk.
┌──(kali㉿kali)-[~]
└─$ df -hT /
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/kali--vg-root ext4 54G 46G 5.5G 90% /

┌──(kali㉿kali)-[~]
└─$ sudo fdisk -l
GPT PMBR size mismatch (125829119 != 209715199) will be corrected by write.
The backup GPT table is not on the end of the device.
Disk /dev/sda: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D855B004-EE7D-4EF0-A116-C114D5EE0C29

Device Start End Sectors Size Type
/dev/sda1 2048 2000895 1998848 976M EFI System
/dev/sda2 2000896 4001791 2000896 977M Linux filesystem
/dev/sda3 4001792 125827071 121825280 58.1G Linux LVM


Disk /dev/mapper/kali--vg-root: 55.09 GiB, 59152269312 bytes, 115531776 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/kali--vg-swap_1: 3 GiB, 3221225472 bytes, 6291456 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

┌──(kali㉿kali)-[~]
└─$ sudo parted -l
Warning: Not all of the space available to /dev/sda appears to be used, you can
fix the GPT to use all of the space (an extra 83886080 blocks) or continue with
the current setting?
Fix/Ignore? Fix
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 1024MB 1023MB fat32 EFI System Partition boot, esp
2 1024MB 2049MB 1024MB ext4
3 2049MB 64.4GB 62.4GB lvm


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/kali--vg-root: 59.2GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number Start End Size File system Flags
1 0.00B 59.2GB 59.2GB ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/kali--vg-swap_1: 3221MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number Start End Size File system Flags
1 0.00B 3221MB 3221MB linux-swap(v1)

After expanding the physical hard disk, a partition table alarm occurred:
GPT PMBR size mismatch (125829119 != 209715199) will be corrected by write.
The backup GPT table is not on the end of the device.

  1. Resize the /dev/sda3 partition.
┌──(kali㉿kali)-[~]
└─$ sudo parted /dev/sda
GNU Parted 3.7
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 1024MB 1023MB fat32 EFI System Partition boot, esp
2 1024MB 2049MB 1024MB ext4
3 2049MB 64.4GB 62.4GB lvm

(parted) unit s
(parted) p free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
34s 2047s 2014s Free Space
1 2048s 2000895s 1998848s fat32 EFI System Partition boot, esp
2 2000896s 4001791s 2000896s ext4
3 4001792s 125827071s 121825280s lvm
125827072s 209715166s 83888095s Free Space

(parted)
(parted) resizepart 3
End? [125827071s]? 209715166s
(parted)
(parted) p free
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 209715200s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
34s 2047s 2014s Free Space
1 2048s 2000895s 1998848s fat32 EFI System Partition boot, esp
2 2000896s 4001791s 2000896s ext4
3 4001792s 209715166s 205713375s lvm

(parted)
(parted) q
Information: You may need to update /etc/fstab.
  1. Resize the PV /dev/sda3.
┌──(kali㉿kali)-[~]
└─$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 kali-vg lvm2 a-- <58.09g 0

┌──(kali㉿kali)-[~]
└─$ sudo pvresize /dev/sda3
Physical volume "/dev/sda3" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized

┌──(kali㉿kali)-[~]
└─$ sudo pvdisplay /dev/sda3
--- Physical volume ---
PV Name /dev/sda3
VG Name kali-vg
PV Size 98.09 GiB / not usable 16.50 KiB
Allocatable yes
PE Size 4.00 MiB
Total PE 25111
Free PE 10240
Allocated PE 14871
PV UUID FJSLjr-bO8M-ha6D-ig60-9FEm-PDeX-GzISvL
  1. Extend the LV /dev/kali-vg/root.
┌──(kali㉿kali)-[~]
└─$ sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root kali-vg -wi-ao---- <55.09g
swap_1 kali-vg -wi-ao---- 3.00g

┌──(kali㉿kali)-[~]
└─$ sudo lvextend -l +100%FREE /dev/kali-vg/root
Size of logical volume kali-vg/root changed from <55.09 GiB (14103 extents) to <95.09 GiB (24343 extents).
Logical volume kali-vg/root successfully resized.
  1. Expand the root(/) filesystem.
┌──(kali㉿kali)-[~]
└─$ sudo resize2fs /dev/kali-vg/root
resize2fs 1.47.4 (6-Mar-2025)
Filesystem at /dev/kali-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 12
The filesystem on /dev/kali-vg/root is now 24927232 (4k) blocks long.

┌──(kali㉿kali)-[~]
└─$ df -hT /
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/kali--vg-root ext4 94G 46G 44G 52% /