[linux-lvm] Underlying physical volume resized?!

Gionatan Danti g.danti at assyoma.it
Tue Nov 15 14:27:03 UTC 2016

Dear all,
I have a question about a warning message LVM is showing. I am using 
CentOS 6.8 x86_64. Here is my pvs/vgs/lvs configuration:

   PV         VG   Fmt  Attr PSize   PFree
   /dev/sda2  vg   lvm2 a--u   9,51g    0
   /dev/sda3  vg   lvm2 a--u 110,00g    0
   /dev/sdb1  vg   lvm2 a--u 120,00g 4,00g

   VG   #PV #LV #SN Attr   VSize   VFree
   vg     3   2   0 wz--n- 239,50g 4,00g

   LV      VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log 
Cpy%Sync Convert
   lv_root vg   -wi-ao---- 233,56g
   lv_swap vg   -wi-ao----   1,94g

Both at kernel discovery (during boot) and when issuing lvs or other LVM 
commands I have the warning:

"Device /dev/sda2 has size of 19945392 sectors which is smaller than 
corresponding PV size of 19945472 sectors. Was device resized? One or 
more devices used as PVs in VG vg have changed sizes."

However, my partitions where never shrunk. fdisk on /dev/sda:

Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders, total 251658240 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 identifier: 0x000a3c73

    Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    20971439     9972696   8e  Linux LVM
/dev/sda3        20971440   251658239   115343400   8e  Linux LVM

By fdisk output, lvm is right: 20971439-1026048+1=19945392, so sda2 is 
80 sectors (40 KB) smaller than lvm expects (19945472 sectors). I 
expanded the root volume quite a few times; however, I *never* resized 
sda2: at each expansion I took a snapshot of the disk's MBR, so I 
already checked that I did not mess with sda2 in the past.

By using lvm metadata archived in /etc/lvm/archive, I think that the 
missing 80 sectors are squarely in the swap space (lv_swap, which used 
the last physical extents when lv_root was much smaller), but I am 
somewhat worried that, given some process write to these "missing" 80 
sectors, something bad can happen to the next adjacent physical extent 
(where live data are store, as it is part of lv_root now).

In short:

1) can someone point me on what happen here, and why lvs only recently 
started to complain?

2) do you think my data are at risk?

3) what I can do to solve the problem? I can think of two different 
approach: a) run pvreside /dev/sda2 to shrunk the physical volume or b) 
shrunk the swap partition to be sure nobody will ever write to the last 
80 sectors.


Danti Gionatan
Supporto Tecnico
Assyoma S.r.l. - www.assyoma.it
email: g.danti at assyoma.it - info at assyoma.it
GPG public key ID: FF5F32A8

More information about the linux-lvm mailing list