[Gllug] Come a cropper with LVM
David L Neil Mailing list a/c
GLLUG at getaroundtoit.co.uk
Thu Mar 19 12:07:36 UTC 2009
Having resized a physical volume, where will I be able to 'see' the
released disk space, in order to re-allocate those extents of disk?
The background:
I have been v.pleased to implement LVM across my test server's disks,
following advice from some here. Drawing on my history with manual
allocation of space on other machines/OpSys going back to mainframes,
I've been very happy to implement LVM and make it work for me - to-date.
When space ran out before, I first managed to add to an existing VG and
later was able to add another chunk of disk into the LVM system -
apropos the advice given the manual to leave yourself room and flexibility.
The regrets:
However now I seem to have outsmarted myself. Hopefully it is simple
terminology failings on my part and nothing major. There has been NO
data loss!
The disk layout:
There are three physical Volume Groups (p1, p2, p3). p1 (sda2) and p2
(sda3) are primary partitions on the same physical drive, contain
multiple logical volumes and free spaces. p3 is constructed from two
logical partitions within a single extended partition on a single drive,
but on physically separate areas of the disk, and consists of a single
logical volume (LVsrv) and (currently) a little free space.
The objective:
LVsrv is used to hold server data and needs expansion to cope with
growing email demands and additional demands for network backup space.
The solution (I thought):
Take some of the free space(s) from volume groups p1 and p2, and make
them available to p3.
- I didn't think it was possible to somehow add those free spaces in the
other Volume Groups to the LVsrv logical volume, ie allocating spaces so
that an LV spans different Volume Groups. Should I have gone that way?
Starting to get myself into trouble:
My first move was to use CentOS 5.2's "Logical Volume Management" GUI
tool (system-config-lvm). Following the manual (9.5.3. Migrating
extents; online at
http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-system-config-lvm-migrate-extents.html)
I highlighted the p1 Volume Group, then opened the p1 Physical View,
then /dev/sda, and finally Partition 2 at which time the "Migrate
Selected Extent(s) from Volume" button appeared, but when I tried to use
it the response was "Please select some extents first" and I could see
no way to pull up the (manual) illustrated dialog box/to identify a
particular range of extents...
Here comes trouble:
So I moved to the command line and INFO/MAN-ed and --help-ed my way
around the various lvm commands (which are more conveniently listed in
the manual as 6.2. LVM Partition Management
http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s1-disk-storage-lvm.html)
noting the -t(est) switch with considerable relief!!!
First attempt:
It seemed logical to attempt to move some extents of disk space from one
LV to another. So I attempted:
lvm pvmove -tv /dev/sda2:1262-1561 /dev/sda10
Test mode: Metadata will NOT be updated.
Finding volume group "p1"
Physical Volume "/dev/sda10" not found in Volume Group "p1"
Test mode: Wiping internal cache
Wiping internal VG cache
- does this only work within a single VG then?
Second attempt:
So then I thought I would 'take away' some excess space from one VG and
add it to the other in two steps. The command with -t worked happily so
I invoked:
lvm pvresize -v --setphysicalvolumesize 38GB /dev/sda2
Using physical volume(s) on command line
Archiving volume group "p1" metadata (seqno 5).
/dev/sda2: Pretending size is 79691776 not 102398310 sectors.
Resizing physical volume /dev/sda2 from 1562 to 1215 extents.
Resizing volume "/dev/sda2" to 79691392 sectors.
Updating physical volume "/dev/sda2"
Creating volume group backup "/etc/lvm/backup/p1" (seqno 6).
Physical volume "/dev/sda2" changed
1 physical volume(s) resized / 0 physical volume(s) not resized
The bad news:
So it worked, but I've used all the pvscan and pvdisplay LVM commands
and even the non-LVM down to parted, that I can think of, and whilst I
can see that P1 is smaller than it was, I can't figure out where the
spare space has gone and thus how to address it in order to re-allocate it.
1 can you tell the chump how to recover the space?
2 what should I have done in the first place?
Please advise,
=dn
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list