Bug 771065 - lvconvert --splitmirrors allows invalid new volume name
lvconvert --splitmirrors allows invalid new volume name
Product: Fedora
Classification: Fedora
Component: lvm2 (Show other bugs)
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Jonathan Earl Brassow
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2011-12-31 10:34 EST by DaveG
Modified: 2012-04-11 08:47 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-04-11 08:47:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description DaveG 2011-12-31 10:34:59 EST
Description of problem:
Tried using mirror and split mirror to back up a running system before upgrade (f14->f16) and tripped over this problem. lvconvert does not validate the new volume name before starting the mirror split. If you mistakenly include the volume group in the new volume name then the split-off volume is there but completely unusable and inaccessible.

Version-Release number of selected component (if applicable):

How reproducible:
Just follow my mistake!

Steps to Reproduce:
0. Take a copy of the VG configuration!!!
  vgcfgbackup -f vgXX.good -v vgXX
1. Create a test logical volume on a machine with three or more disks.
2. Convert to a mirrored volume.
  lvconvert --mirrors 1 --alloc contiguous vgXX/lvXX /dev/sdXN /dev/sdYN
3. Split the mirror to create a new volume with a bad name.
  lvconvert --splitmirrors 1 -n vgXX/lvYY vgXX/lvXX /dev/sdXN
  ------------------------------^^^^^ Oops.

Actual results:
New LV fails activation leaving:

LV "vgXX/vgXX/lvYY" is listed but none of the LVM tools will work with it.
LVM GUI crashes on start-up.

Expected results:
Error message at invocation and refuse to split off an invalid volume name.

Additional info:
Do not test on a valuable system!
Use vgcfgbackup before testing and use vgcfgrestore after to unwind the changes, or manually edit a configuration and restore. That's the only way I could restore sanity!

Comment 1 Alasdair Kergon 2011-12-31 21:35:31 EST
--name accepts the vg/lv format

Sounds like lvconvert needs fixing to deal with the vg/ part appropriately.
Comment 2 Peter Rajnoha 2012-04-11 08:47:50 EDT
Fixed in lvm2 v2.02.96: "Detect VG name being part of the LV name in lvconvert --splitmirrors -n.", https://www.redhat.com/archives/lvm-devel/2012-March/msg00189.html

Note You need to log in before you can comment on or make changes to this bug.