linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] Bug in LVM2 tools
@ 2006-10-04 21:05 Xuân Baldauf
  2006-10-04 22:05 ` Alasdair G Kergon
  2006-10-04 22:28 ` Alasdair G Kergon
  0 siblings, 2 replies; 3+ messages in thread
From: Xuân Baldauf @ 2006-10-04 21:05 UTC (permalink / raw)
  To: linux-lvm

Hello,

I observed an obscure bug in the current LVM2 tools. Observe this:


# dd if=/dev/zero of=testfile bs=1024k count=1
1+0 records in
1+0 records out
1048576 bytes (1,0 MB) copied, 0,009037 seconds, 116 MB/s
# losetup /dev/loop4 testfile
# pvcreate /dev/loop4
  Physical volume "/dev/loop4" successfully created
# vgcreate --physicalextentsize=1k test.vg /dev/loop4
  Volume group "test.vg" successfully created
# lvcreate --name=test.lv --size=832k test.vg
  Insufficient free extents (640) in volume group test.vg: 832 required
# vgremove test.vg
  Volume group "test.vg" successfully removed
# vgcreate --physicalextentsize=1k test.vg /dev/loop4
  Volume group "test.vg" successfully created
# lvcreate --name=test.lv --size=832k test.vg
  Logical volume "test.lv" created
#

I create a file "testfile" of 1024KiB size and view it as /dev/loop4.
Then I create a physical volume on /dev/loop4 and a volume group
"test.vg" covering that physical volume. The metadata needs the first
192KiB. However, I cannot use the remaining 832KiB for a logical volume.
This is the bug.

However, if I remove the volume group "test.vg" and once more create it
again, now the remaining 832KiB are fully usable. This behaviour is
inconsistent.

Analyzing the metadata after the first "vgcreate", one can see that the
pe_count of the physical volume is too small. It seems that there is
space reserved for a second metadata copy at the end of /dev/loop4,
however, no second metadata copy is requrested at the invocation of
"pvcreate".

For me, it is in particuliar important that the first "vgcreate" does
not use any extra space at the end of the block device the physical
volume lives on, as, in my case, the physical volume contains already
data (which is to be made available as a logical volume).

ciao,
Xu�n.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] Bug in LVM2 tools
  2006-10-04 21:05 [linux-lvm] Bug in LVM2 tools Xuân Baldauf
@ 2006-10-04 22:05 ` Alasdair G Kergon
  2006-10-04 22:28 ` Alasdair G Kergon
  1 sibling, 0 replies; 3+ messages in thread
From: Alasdair G Kergon @ 2006-10-04 22:05 UTC (permalink / raw)
  To: Xuân Baldauf; +Cc: linux-lvm

Curious - I've even managed to get vgcreate to generate a pe_count of 0:-)

Alasdair
-- 
agk@redhat.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] Bug in LVM2 tools
  2006-10-04 21:05 [linux-lvm] Bug in LVM2 tools Xuân Baldauf
  2006-10-04 22:05 ` Alasdair G Kergon
@ 2006-10-04 22:28 ` Alasdair G Kergon
  1 sibling, 0 replies; 3+ messages in thread
From: Alasdair G Kergon @ 2006-10-04 22:28 UTC (permalink / raw)
  To: LVM general discussion and development

On Wed, Oct 04, 2006 at 11:05:51PM +0200, Xu�n Baldauf wrote:
> I observed an obscure bug in the current LVM2 tools. Observe this:
 
> # vgcreate --physicalextentsize=1k test.vg /dev/loop4

When you have larger PEs, this bug gets lost in the rounding that gets done
for alignment.

> It seems that there is
> space reserved for a second metadata copy at the end of /dev/loop4,

It's not actually related to that - it's simply a mistake in the logic that
means it adjusts for the metadata areas both in pvcreate and then a second
time in vgcreate.  When you run vgremove it now reinstates the full disk
size (a bug fix that was applied) so the subsequent vgcreate only makes a
single (correct) adjustment.  In short, there's confusion of responsibility
between pvcreate and vgcreate for calculating the usable data area size
that holds the PEs.

Alasdair
-- 
agk@redhat.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-04 22:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-04 21:05 [linux-lvm] Bug in LVM2 tools Xuân Baldauf
2006-10-04 22:05 ` Alasdair G Kergon
2006-10-04 22:28 ` Alasdair G Kergon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).