I work on a Debian buster system as a KVM/libvirt host and followed this guide to extend the disk of my guest: https://computingforgeeks.com/how-to-extend-increase-kvm-virtual-machine-disk-size/ .
When extending the disk of a kvm/libvirt guest from 50G to 200G, after rebooting the guest I get the error:
WARNING: Device /dev/sda5 has size of 103854080 sectors which is smaller than corresponding PV size of 418426880 sectors. Was device resized?
The last thing I did before the reboot was to resize the LV, after extending the PV.
I would have expected to be able to resize the partition and then the filesystem, but I am not. I guess the LVM is confused about its size. How can I get it to update the size info of the different containers (physical volume, logical volume, volume group, partion)?
this is the diagnostic output i get:
pvs
WARNING: Device /dev/sda5 has size of 103854080 sectors which is smaller than corresponding PV size of 418426880 sectors. Was device resized?
One or more devices used as PVs in VG cosa-cloud-vg have changed sizes.
PV VG Fmt Attr PSize PFree
/dev/sda5 cosa-cloud-vg lvm2 a-- <199.52g 5.00g
vgs
WARNING: Device /dev/sda5 has size of 103854080 sectors which is smaller than corresponding PV size of 418426880 sectors. Was device resized?
One or more devices used as PVs in VG cosa-cloud-vg have changed sizes.
VG #PV #LV #SN Attr VSize VFree
cosa-cloud-vg 1 2 0 wz--n- <199.52g 5.00g
lvs
WARNING: Device /dev/sda5 has size of 103854080 sectors which is smaller than corresponding PV size of 418426880 sectors. Was device resized?
One or more devices used as PVs in VG cosa-cloud-vg have changed sizes.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root cosa-cloud-vg -wi------- 193.56g
swap_1 cosa-cloud-vg -wi-a----- 980.00m
fdisk -l
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors
Disk model: QEMU HARDDISK
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: dos
Disk identifier: 0xf64fd2c9
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 1001470 104855551 103854082 49.5G 5 Extended
/dev/sda5 1001472 104855551 103854080 49.5G 8e Linux LVM
Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors
Disk model: QEMU HARDDISK
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/cosa--cloud--vg-swap_1: 980 MiB, 1027604480 bytes, 2007040 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
(parted) print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 419430400s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 2048s 999423s 997376s primary ext2 boot
2 1001470s 104855551s 103854082s extended
5 1001472s 104855551s 103854080s logical lvm
Note the discrepancy between fdisk and parted regarding the disk size (200G vs 215G). Not sure what that means.