Re: [Hampshire] LVM problems

Top Page
Author: Hugo Mills
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] LVM problems

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x57276100.hantslug.org.uk.7690': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Tue Oct 26 15:30:44 2010 BST
gpg: using DSA key 20ACB3BE515C238D
gpg: Can't check signature: No public key
On Tue, Oct 26, 2010 at 03:18:15PM +0100, Chris Smith wrote:
> On 26/10/10 15:09, Hugo Mills wrote:
> > On Tue, Oct 26, 2010 at 03:03:47PM +0100, Vic wrote:
> >> OK, here comes the next one. sda5 is reported as:
> >>
> >>>  5      257MB   125GB  125GB   logical                lvm


This is 116GiB. In fact, from the fdisk output, the total size of
the partition is 124998647808 bytes.

> >> But in the pvdisplay output, we get:
> >>
> >>   PV Name               /dev/sda5
> >>   Total PE              38095
> >>   Free PE               10452
> >>   Allocated PE          27643


> Bah! Too many numbers. I completely missed that. :(


38095 Physical Extents is 159782010880 bytes.

> >    Chris: Can you show us the output of pvdisplay --maps /dev/sda5,
> > please?

>
> Ok, output below. I haven't resized the partitions; they were created
> by the Ubuntu Lucid installer (alternate CD) and I haven't touched them
> since. I believe I have lvextended the home partition, but that's it.
>
>   --- Physical volume ---
>   PV Name               /dev/sda5
>   VG Name               pooky_vg
>   PV Size               148.81 GiB / not usable 2.00 MiB
>   Allocatable           yes
>   PE Size               4.00 MiB
>   Total PE              38095
>   Free PE               10452
>   Allocated PE          27643
>   PV UUID               6vjc8d-5N80-0HrF-JzFb-l8o7-NcBD-bOn76g

>
>   --- Physical Segments ---
>   Physical extent 0 to 4767:
>     Logical volume    /dev/pooky_vg/lucid_system_lv
>     Logical extents    0 to 4767
>   Physical extent 4768 to 5482:
>     Logical volume    /dev/pooky_vg/swap_lv
>     Logical extents    0 to 714
>   Physical extent 5483 to 17402:
>     Logical volume    /dev/pooky_vg/home_lv
>     Logical extents    0 to 11919
>   Physical extent 17403 to 22522:
>     Logical volume    /dev/pooky_vg/media_lv
>     Logical extents    0 to 5119
>   Physical extent 22523 to 27642:
>     Logical volume    /dev/pooky_vg/home_lv
>     Logical extents    11920 to 17039
>   Physical extent 27643 to 38094:
>     FREE


The last allocated PE on this PV is the 27643th, so you've got
115943145472 bytes assigned on the PV.

Now, 124998647808 - 115943145472 = 9055502336, which is
approximately 8.43GiB or so, which matches the maximum size of LV you
can create.

I think that the following will fix your problems. However, take
backups first, as if I've got anything wrong, you could lose the whole
VG.

# lvresize --setphysicalvolumesize 117016887296b /dev/sda5
# lvresize /dev/sda5

The first will shrink the PV down to within a gigabyte or so of the
allocated space -- several gigabytes inside the partition. The second
should expand again to fill the partition.

Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
                      --- vi: The core of evil. ---