[linux-lvm] How to Fix Bad PV Allocation

Eddie stunnel at attglobal.net
Wed Oct 14 01:45:17 UTC 2009


I have a PV allocated, that is larger than the actual volume it resides on.

Somehow, and I've not been able to ascertain how, when fdisk was run, on 
a new RAID array it produced the following partition size:

fdisk -l -u /dev/sda

Disk /dev/sda: 1499.9 GB, 1499999502336 bytes
255 heads, 63 sectors/track, 182364 cylinders, total 2929686528 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x0003d809

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63  2930304194  1465152066   8e  Linux LVM

The complete /dev/sda1 was then allocated to a PV.

Later, at boot time, I noticed warnings about the partition allocation 
being larger than the actual disk, which led me to investigate what was 
wrong.  After correcting this, fisk now reports the correct size for the 
partition:

fdisk -l -u /dev/sda

Disk /dev/sda: 1499.9 GB, 1499999502336 bytes
255 heads, 63 sectors/track, 182364 cylinders, total 2929686528 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x0003d809

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63  2929677659  1464838798+  8e  Linux LVM

However, the PV allocations are still based on the "incorrect" partition 
sizing, and hence, they are also incorrect:

pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               raid_vg
  PV Size               1.36 TB / not usable 2.97 MB
  Allocatable           yes
  PE Size (KByte)       4096
  Total PE              357627
  Free PE               76027
  Allocated PE          281600
  PV UUID               OOBb0e-8fyt-mhfr-Oshw-mS8d-Mcay-t2ixBb

This shows a "Total PE" of 357627, which according to my maths, comes 
out to 1,464,840,102 Blocks, or 2,929,680,384 Sectors, on the device.  
This is larger that the actual disk.

How can I correct the PV allocations, so that they reflect the actual 
device, not the "incorrect" sizes, that were present when PVCREATE was 
originally run.

Cheers,
Eddie





More information about the linux-lvm mailing list