Bug 1056452
| Summary: | lvm2 should clean any stale signatures and metadata found on newly created LV and PV | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Peter Rajnoha <prajnoha> |
| Component: | lvm2 | Assignee: | LVM and device-mapper development team <lvm-team> |
| lvm2 sub component: | Default / Unclassified | QA Contact: | cluster-qe <cluster-qe> |
| Status: | CLOSED CURRENTRELEASE | Docs Contact: | |
| Severity: | medium | ||
| Priority: | medium | CC: | agk, dwysocha, heinzm, jbrassow, mpatocka, msnitzer, nperic, prajnoha, prockai, thornber, todoleza, zkabelac |
| Version: | 7.0 | Keywords: | Triaged |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | lvm2-2.02.105-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 997223 | Environment: | |
| Last Closed: | 2014-06-13 09:50:52 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Peter Rajnoha
2014-01-22 09:09:48 UTC
To QA:
To test this, create an LV and create some foreign signature on the LV - whatever you find in "blkid -k". E.g. the MD (the original bug report):
[0] raw/~ # pvcreate /dev/sda
Physical volume "/dev/sda" successfully created
[0] raw/~ # vgcreate vg /dev/sda
Volume group "vg" successfully created
[0] raw/~ # lvcreate -L32m vg
Logical volume "lvol0" created
[0] raw/~ # lvcreate -L32m vg
Logical volume "lvol1" created
[0] raw/~ # mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/vg/lvol0 /dev/vg/lvol1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[0] raw/~ # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
|-vg-lvol0 253:2 0 32M 0 lvm
| `-md0 9:0 0 32M 0 raid1
`-vg-lvol1 253:3 0 32M 0 lvm
`-md0 9:0 0 32M 0 raid1
[0] raw/~ # mdadm -S /dev/md0
mdadm: stopped /dev/md0
[0] raw/~ # lvremove -ff vg
Logical volume "lvol0" successfully removed
Logical volume "lvol1" successfully removed
[0] raw/~ # lvcreate -L32m vg
WARNING: linux_raid_member signature detected on /dev/vg/lvol0 at offset 4096. Wipe it? [y/n] y
Wiping linux_raid_member signature on /dev/vg/lvol0.
Logical volume "lvol0" created
[0] raw/~ # lvcreate -L32m vg
WARNING: linux_raid_member signature detected on /dev/vg/lvol1 at offset 4096. Wipe it? [y/n] y
Wiping linux_raid_member signature on /dev/vg/lvol1.
Logical volume "lvol1" created
[0] raw/~ # lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
|-vg-lvol0 253:2 0 32M 0 lvm
`-vg-lvol1 253:3 0 32M 0 lvm
^^^ the important thing here is that the "linux_raid_member" signature got removed and also the MD array has not been autostarted from udev (as MD uses autoactivation with the help of udev).
The same would apply for FS signatures, e.g.:
[0] raw/~ # pvcreate /dev/sda
Physical volume "/dev/sda" successfully created
[0] raw/~ # vgcreate vg /dev/sda
Volume group "vg" successfully created
[0] raw/~ # lvcreate -L32m vg
Logical volume "lvol0" created
[0] raw/~ # mkfs /dev/vg/lvol0
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
8192 inodes, 32768 blocks
1638 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=33554432
4 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
[0] raw/~ # lvremove -ff vg
Logical volume "lvol0" successfully removed
[0] raw/~ # lvcreate -L32m vg
WARNING: ext2 signature detected on /dev/vg/lvol0 at offset 1080. Wipe it? [y/n] y
Wiping ext2 signature on /dev/vg/lvol0.
Logical volume "lvol0" created
...and similarly for any other signature that is recognized by libblkid (see the "blkid -k" output for the list of recognized signatures).
===
The same applies for pvcreate:
[0] raw/~ # mkfs /dev/sda
mke2fs 1.42.9 (28-Dec-2013)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
32768 inodes, 131072 blocks
6553 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
16 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
[0] raw/~ # pvcreate /dev/sda
WARNING: ext2 signature detected on /dev/sda at offset 1080. Wipe it? [y/n] y
Wiping ext2 signature on /dev/sda.
Physical volume "/dev/sda" successfully created
Current behavior VERIFIED with
lvm2-2.02.105-14.el7 BUILT: Wed Mar 26 14:29:41 CET 2014
lvm2-libs-2.02.105-14.el7 BUILT: Wed Mar 26 14:29:41 CET 2014
lvm2-cluster-2.02.105-14.el7 BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-1.02.84-14.el7 BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-libs-1.02.84-14.el7 BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-event-1.02.84-14.el7 BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-event-libs-1.02.84-14.el7 BUILT: Wed Mar 26 14:29:41 CET 2014
device-mapper-persistent-data-0.2.8-5.el7 BUILT: Sat Mar 1 02:15:56 CET 2014
cmirror-2.02.105-14.el7 BUILT: Wed Mar 26 14:29:41 CET 2014
A part of test:
[root@virt-062 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 12G 0 disk
└─sda1 8:1 0 12G 0 part
├─vg-lvol0 253:2 0 500M 0 lvm
│ └─md127 9:127 0 499.7M 0 raid1
└─vg-lvol1 253:3 0 500M 0 lvm
└─md127 9:127 0 499.7M 0 raid1
[root@virt-062 ~]# mdadm -S /dev/md127
mdadm: stopped /dev/md127
[root@virt-062 ~]# lvremove vg
Do you really want to remove active logical volume lvol0? [y/n]: y
Logical volume "lvol0" successfully removed
Do you really want to remove active logical volume lvol1? [y/n]: y
Logical volume "lvol1" successfully removed
[root@virt-062 ~]# lvcreate -L1G vg
WARNING: linux_raid_member signature detected on /dev/vg/lvol0 at offset 4096. Wipe it? [y/n] y
Wiping linux_raid_member signature on /dev/vg/lvol0.
Logical volume "lvol0" created
[root@virt-062 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 12G 0 disk
└─sda1 8:1 0 12G 0 part
├─test-lvol0 253:2 0 500M 0 lvm
│ └─layer-lvol0 253:4 0 252M 0 lvm
└─test-lvol1 253:3 0 1G 0 lvm
[root@virt-062 ~]# vgremove -ff layer
Logical volume "lvol0" successfully removed
Volume group "layer" successfully removed
[root@virt-062 ~]# vgremove -ff test
Logical volume "lvol0" successfully removed
Logical volume "lvol1" successfully removed
Volume group "test" successfully removed
[root@virt-062 ~]# vgcreate vg /dev/sda1 /dev/sdb1 /dev/sdc1
Volume group "vg" successfully created
[root@virt-062 ~]# lvcreate -L 500M vg
WARNING: LVM2_member signature detected on /dev/vg/lvol0 at offset 536. Wipe it? [y/n] y
Wiping LVM2_member signature on /dev/vg/lvol0.
Logical volume "lvol0" created
LVM successfully recognized signatures on devices.
This request was resolved in Red Hat Enterprise Linux 7.0. Contact your manager or support representative in case you have further questions about the request. |