Bug 1323950
Summary: | Resizing PV to be larger than the containing partition is allowed without force. | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Marian Csontos <mcsontos> |
Component: | lvm2 | Assignee: | LVM and device-mapper development team <lvm-team> |
lvm2 sub component: | Default / Unclassified | QA Contact: | cluster-qe <cluster-qe> |
Status: | CLOSED ERRATA | Docs Contact: | |
Severity: | unspecified | ||
Priority: | unspecified | CC: | agk, cmarthal, heinzm, jbrassow, msnitzer, prajnoha, prockai, rbednar, thornber, zkabelac |
Version: | 7.3 | ||
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | lvm2-2.02.160-1.el7 | Doc Type: | Bug Fix |
Doc Text: |
There's a new warning message issued if PV size recorded in LVM metadata is more than actual device size and the PV is part of a VG. This situation may happen in case --setphysicalvolume is used to override actual device size during pvcreate or if the device size changed after creating a PV.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2016-11-04 04:19:47 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
Marian Csontos
2016-04-05 07:20:50 UTC
We do have a warning now which checks the PV size against size stored in metadata: # pvcreate --setphysicalvolumesize 300M /dev/sda WARNING: /dev/sda: Overriding real size. You could lose data. Physical volume "/dev/sda" successfully created. # vgcreate vg /dev/sda WARNING: Device /dev/sda has size of 262144 sectors which is smaller than corresponding PV size of 614400 sectors. Was device resized? Volume group "vg" successfully created # pvs WARNING: Device /dev/sda has size of 262144 sectors which is smaller than corresponding PV size of 614400 sectors. Was device resized? One or more devices used as PVs in VG vg have changed sizes. PV VG Fmt Attr PSize PFree /dev/sda vg lvm2 a-- 296.00m 296.00m # vgs WARNING: Device /dev/sda has size of 262144 sectors which is smaller than corresponding PV size of 614400 sectors. Was device resized? One or more devices used as PVs in VG vg have changed sizes. ... # lvs WARNING: Device /dev/sda has size of 262144 sectors which is smaller than corresponding PV size of 614400 sectors. Was device resized? One or more devices used as PVs in VG vg have changed sizes. ... === However, we don't show this warning if PV is not yet part of any VG - that's because there's no risk of losing data yet, the risk is only if we're trying to allocate LVs on such PVs: # pvcreate --setphysicalvolumesize 300M /dev/sda Incorrect metadata area header checksum on /dev/sda at offset 4096 WARNING: /dev/sda: Overriding real size. You could lose data. Physical volume "/dev/sda" successfully created. # pvs PV VG Fmt Attr PSize PFree /dev/sda lvm2 --- 300.00m 300.00m === These checks are there since lvm2 v 2.02.141: https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=d090d6574e455625ad4e2a1a6f3d93f5c663b097 https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=1f5dfb7369600c169ecd2c78e0cd079ad1442548 https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=c0912af3104cb72ea275d90b8b1d68a25a9ca48a https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=136fd8f2f642c82b132ded4b9a95b05e822e9117 https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=bc8f8ac0facc610c3252eb9af592b9c63a935ce2 === As for the requirement for the --force - well, the --setphysicalvolumesize option itself is considered relatively dangerous and even the man page says: --setphysicalvolumesize size Overrides the automatically-detected size of the PV. Use with care. So if someone uses that for whatever reason, he probably knows what he's doing. But yes, maybe we should add Y/N question to make sure. There's also pvresize --setphysicalvolumesize to consider... (In reply to Peter Rajnoha from comment #2) > As for the requirement for the --force - well, the --setphysicalvolumesize > option itself is considered relatively dangerous and even the man page says: > > --setphysicalvolumesize size > Overrides the automatically-detected size of the PV. Use with > care. > > So if someone uses that for whatever reason, he probably knows what he's > doing. But yes, maybe we should add Y/N question to make sure. Still, someone may already use this in existing scripts and this options is more for power users than for common everyday use. If people use such PV in a VG, we do have a warning now. Also, that option is there for ages and we haven't had any reports from our customers related to use of this option - so let's just go with the warning that gets issued in lvm commands if there's a PV where size is more than its device's real size. Adding QA ack for 7.3. Marking verified in the latest rpms. Like mentioned in comment #3, there is no prompt now, just additional warning messages when resizing PVs larger than their actual partition size. # RHEL7.2 lvm2-2.02.130-5 [root@host-128 ~]# pvcreate /dev/sda1 Physical volume "/dev/sda1" successfully created [root@host-128 ~]# vgcreate vg /dev/sda1 Volume group "vg" successfully created [root@host-128 ~]# pvresize --setphysicalvolumesize 30G /dev/sda1 WARNING: /dev/sda1: Overriding real size. You could lose data. Physical volume "/dev/sda1" changed 1 physical volume(s) resized / 0 physical volume(s) not resized [root@host-128 ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda1 vg lvm2 a-- 30.00g 30.00g [root@host-128 ~]# vgs VG #PV #LV #SN Attr VSize VFree vg 1 0 0 wz--n- 30.00g 30.00g [root@host-128 ~]# pvresize --setphysicalvolumesize 40G /dev/sda1 WARNING: /dev/sda1: Overriding real size. You could lose data. Physical volume "/dev/sda1" changed 1 physical volume(s) resized / 0 physical volume(s) not resized # RHEL7.3 lvm2-2.02.165-1 [root@host-118 ~]# pvcreate /dev/sda1 Physical volume "/dev/sda1" successfully created. [root@host-118 ~]# vgcreate vg /dev/sda1 Volume group "vg" successfully created [root@host-118 ~]# pvresize --setphysicalvolumesize 30G /dev/sda1 WARNING: /dev/sda1: Overriding real size. You could lose data. Physical volume "/dev/sda1" changed 1 physical volume(s) resized / 0 physical volume(s) not resized [root@host-118 ~]# pvs WARNING: Device /dev/sda1 has size of 41929587 sectors which is smaller than corresponding PV size of 62912512 sectors. Was device resized? One or more devices used as PVs in VG vg have changed sizes. PV VG Fmt Attr PSize PFree /dev/sda1 vg lvm2 a-- 30.00g 30.00g [root@host-118 ~]# vgs WARNING: Device /dev/sda1 has size of 41929587 sectors which is smaller than corresponding PV size of 62912512 sectors. Was device resized? One or more devices used as PVs in VG vg have changed sizes. VG #PV #LV #SN Attr VSize VFree vg 1 0 0 wz--n- 30.00g 30.00g [root@host-118 ~]# pvresize --setphysicalvolumesize 40G /dev/sda1 WARNING: Device /dev/sda1 has size of 41929587 sectors which is smaller than corresponding PV size of 62912512 sectors. Was device resized? One or more devices used as PVs in VG vg have changed sizes. WARNING: /dev/sda1: Overriding real size. You could lose data. Physical volume "/dev/sda1" changed 1 physical volume(s) resized / 0 physical volume(s) not resized Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2016-1445.html |