15.10: pvs/pvscan/pvdisplay not recognising PV metadata when lvmetad is running

Bug #1490088 reported by TJ
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lvm2 (Ubuntu)
Triaged
Undecided
Unassigned

Bug Description

Working on a 14.04 amd64 host with a 15.10 chroot I found that several PV tools cannot recognise PVs created on 14.04.

As a test on 14.04 I created 2 test loop device files and used pvcreate on them (loop0 has zero metadata copies).

## In 14.04:

$ sudo losetup -vf /var/lib/schroot/metadata-test.bin
Loop device is /dev/loop0
$ sudo losetup -vf /var/lib/schroot/metadata-test-2.bin
Loop device is /dev/loop1
$ sudo losetup -a
/dev/loop0: [fc17]:2612 (/var/lib/schroot/metadata-test.bin)
/dev/loop1: [fc17]:2613 (/var/lib/schroot/metadata-test-2.bin)
$ file -s /dev/loop[0-1]
/dev/loop0: LVM2 PV (Linux Logical Volume Manager), UUID: t304eP-t7dr-z52W-7Agt-nEdB-Kv7G-3dNObh, size: 1073741824
/dev/loop1: LVM2 PV (Linux Logical Volume Manager), UUID: 6194QF-wn0J-69C4-WCVc-rFxw-XwXJ-3fMXXb, size: 524288000
$ blkid /dev/loop[0-1]
/dev/loop0: UUID="t304eP-t7dr-z52W-7Agt-nEdB-Kv7G-3dNObh" TYPE="LVM2_member"
/dev/loop1: UUID="6194QF-wn0J-69C4-WCVc-rFxw-XwXJ-3fMXXb" TYPE="LVM2_member"
$ sudo pvck /dev/loop[0-1]
  Found label on /dev/loop0, sector 0, type=LVM2 001
  Found label on /dev/loop1, sector 1, type=LVM2 001
  Found text metadata area: offset=4096, size=1044480

$ sudo pvs /dev/loop[0-1]
  PV VG Fmt Attr PSize PFree
  /dev/loop0 Test lvm2 a-- 1020.00m 1020.00m
  /dev/loop1 Test lvm2 a-- 496.00m 496.00m

## In 15.10

# file -s /dev/loop[0-1]
/dev/loop0: LVM2 PV (Linux Logical Volume Manager), UUID: t304eP-t7dr-z52W-7Agt-nEdB-Kv7G-3dNObh, size: 1073741824
/dev/loop1: LVM2 PV (Linux Logical Volume Manager), UUID: 6194QF-wn0J-69C4-WCVc-rFxw-XwXJ-3fMXXb, size: 524288000
# blkid /dev/loop[0-1]
/dev/loop0: UUID="t304eP-t7dr-z52W-7Agt-nEdB-Kv7G-3dNObh" TYPE="LVM2_member"
/dev/loop1: UUID="6194QF-wn0J-69C4-WCVc-rFxw-XwXJ-3fMXXb" TYPE="LVM2_member"
# pvck /dev/loop[0-1]
  Found label on /dev/loop0, sector 0, type=LVM2 001
  Found label on /dev/loop1, sector 1, type=LVM2 001
  Found text metadata area: offset=4096, size=1044480

# pvs /dev/loop[0-1]
  Failed to find physical volume "/dev/loop0".
  Failed to find physical volume "/dev/loop1".

## In the 15.10 chroot I created another loop device file and used pvcreate on it.

# losetup -vf /var/lib/schroot/metadata-test-3.bin
# losetup -a
/dev/loop0: [64535]:2612 (/var/lib/schroot/metadata-test.bin)
/dev/loop1: [64535]:2613 (/var/lib/schroot/metadata-test-2.bin)
/dev/loop2: [64535]:1056349 (/var/lib/schroot/metadata-test-3.bin)
# file -s /dev/loop2
/dev/loop2: LVM2 PV (Linux Logical Volume Manager), UUID: 7auwAs-qqGs-MZ0c-ns74-jdlh-kGOS-s8kJjE, size: 629145600
# blkid /dev/loop2
/dev/loop2: UUID="7auwAs-qqGs-MZ0c-ns74-jdlh-kGOS-s8kJjE" TYPE="LVM2_member"
# pvck /dev/loop2
  Found label on /dev/loop2, sector 1, type=LVM2 001
  Found text metadata area: offset=4096, size=1044480
# pvs /dev/loop2
  PV VG Fmt Attr PSize PFree
  /dev/loop2 lvm2 --- 600.00m 600.00m

## In the 14.04 host

$ sudo losetup -a
/dev/loop0: [fc17]:2612 (/var/lib/schroot/metadata-test.bin)
/dev/loop1: [fc17]:2613 (/var/lib/schroot/metadata-test-2.bin)
/dev/loop2: [fc17]:1056349 (/var/lib/schroot/metadata-test-3.bin)
$ file -s /dev/loop2
/dev/loop2: LVM2 PV (Linux Logical Volume Manager), UUID: 7auwAs-qqGs-MZ0c-ns74-jdlh-kGOS-s8kJjE, size: 629145600
$ blkid /dev/loop2
/dev/loop2: UUID="7auwAs-qqGs-MZ0c-ns74-jdlh-kGOS-s8kJjE" TYPE="LVM2_member"
$ sudo pvck /dev/loop2
  Found label on /dev/loop2, sector 1, type=LVM2 001
  Found text metadata area: offset=4096, size=1044480
$ sudo pvs /dev/loop2
  PV VG Fmt Attr PSize PFree
  /dev/loop2 lvm2 a-- 600.00m 600.00m

## 14.04
apt-cache policy lvm2
lvm2:
  Installed: 2.02.98-6ubuntu2
  Candidate: 2.02.98-6ubuntu2
  Version table:
 *** 2.02.98-6ubuntu2 0
        500 http://gb.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

## 15.10
# apt-cache policy lvm2
lvm2:
  Installed: 2.02.122-1ubuntu1
  Candidate: 2.02.122-1ubuntu1
  Version table:
 *** 2.02.122-1ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
        100 /var/lib/dpkg/status

TJ (tj)
summary: - 15.10: pvs/pvscan/pvdisplay not recognising PV metadata created by 14.04
+ 15.10: pvs/pvscan/pvdisplay not recognising PV metadata when lvmetad is
+ running
Revision history for this message
TJ (tj) wrote :

Workaround is:

service lvm2-lvmetad stop

Problem is that lvmetad is designed to cache device metadata on discovery, which (should) come from specialised udevd rules. In the chroot there is no init/udevd running so even re-attaching the loop devices doesn't cause the PVs to be scanned.

There is a RedHat mailing list reference to this issue at:

http://www.redhat.com/archives/linux-lvm/2014-October/msg00043.html

TJ (tj)
Changed in lvm2 (Ubuntu):
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.