[linux-lvm] Corrupt PV (wrong size)

Stuart D. Gathman stuart at bmsi.com
Mon Mar 5 22:31:49 UTC 2012


Long ago, Nostradamus foresaw that on Mar 5, Richard Petty would write:

> GOAL: Retrieve a KVM virtual machine from an inaccessible LVM volume.
>
> DESCRIPTION: In November, I was working on a home server. The system
> boots to software mirrored drives but I have a hardware-based RAID5
> array on it and I decided to create a logical volume and mount it at
> /var/lib/libvirt/images so that all my KVM virtual machine image
> files would reside on the hardware RAID.
>
> All that worked fine. Later, I decided to expand that
> logical volume and that's when I made a mistake which wasn't
> discovered until about six weeks later when I accidentally rebooted
> the server. (Good problems usually require several mistakes.)
>
> Somehow, I accidentally mis-specified the second LMV physical
> volume that I added to the volume group. When trying to activate
> the LV filesystem, the device mapper now complains:
>
> LOG ENTRY
> table: 253:3: sdc2 too small for target: start=2048, len=1048584192, dev_size=1048577586
>
> As you can see, the length is greater than the device size.

I've run into something like this.  The issue was that the device was
reporting the incorrect size.  It turned out to be buggy firmware in the 
SATA/USB adapter.  Using another adapter or connecting the drive directly
to SATA made the problem go away.

You didn't mention the crucial details of which PV was on which kind of
device.

You could try pvresize on sdc2, which could succeed if it won't invalidate
any extents.  The size difference is small.

You might have changed the partition table on sdc, and the change would
be written to disk (with a warning) but wouldn't be seen until you rebooted.

As long as the origin didn't change, pvresize will fix it, at most losing
one extent at the end of sdc2.  (Size difference is 6606 sectors, ~3M.)

--
 	      Stuart D. Gathman <stuart at bmsi.com>
     Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the linux-lvm mailing list