Bug 128380

Summary: pvcreate overwrites partition when wildcarding command line options
Product: Red Hat Enterprise Linux 3 Reporter: Dave Horner <david>
Component: lvmAssignee: Heinz Mauelshagen <heinzm>
Status: CLOSED DUPLICATE QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: medium    
Version: 3.0CC: agk
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-08-31 13:33:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dave Horner 2004-07-22 13:28:10 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922

Description of problem:
I came across this during RH300 training.

While initialising 4 partions using pvcreate I tried to cut corners by
instead of doing :

pvcreate /dev/hda9
pvcreate /dev/hda10
pvcreate /dev/hda11
pvcreate /dev/hda12

I attempted this instead:

pvcreate /dev/hda[9-12]

This then destroyed /dev/hda2 - without any warning (and it was
mounted on /usr !)

After rebuilding the system I repeated the issue using variations of
this command line.  Results below:

pvcreate /dev/hda[9-10]
[root@station1 RPMS]# pvcreate /dev/hda[9-10]
pvcreate -- invalid physical volume name "/dev/hda[9-10]"

pvcreate /dev/hda[9-11] destroyed /dev/hda1
pvcreate /dev/hda[9-12] destroyed /dev/hda2







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

How reproducible:
Always

Steps to Reproduce:
shown in description
    

Actual Results:  shown in description

Expected Results:  shown in description

Additional info:

shown in description

Comment 1 Alasdair Kergon 2004-08-12 16:17:04 UTC
Always use 'echo' to check how the shell will expand what you type:
  echo pvcreate /dev/hda[9-11]
gives
  pvcreate /dev/hda1

To understand this, read the man page for your shell eg the 'Pattern
Matching' section of 'man bash'.