Bug 120909

Summary: its possible to run pvcreate on a mounted disk, destroying all its data
Product: Red Hat Enterprise Linux 3 Reporter: Mike MacCana <mmaccana>
Component: lvmAssignee: Alasdair Kergon <agk>
Status: CLOSED DUPLICATE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: low    
Version: 3.0Keywords: FutureFeature
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-08-31 13:35:32 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 Mike MacCana 2004-04-15 05:14:07 UTC
Description of problem:
This isn't a bug, but its a *very* unforgiving behavior. pvcreate
doesn't seem to check whether the device being written to is in use.
There's nothing to stop a customer confused about their partitioning
to run pvcreate over, say, the device currently being used for /.

I'm an RHCX. A student sitting an RH133 lab just did this,
accidentally following the devices used in the notes' example rather
than using the partitions he'd just created. Now his machine isn't usable.

If its possible to 'reverse' a pvcreate, I can't seem to find much
documentation for this.

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

How reproducible:
Always

Steps to Reproduce:
1.Make a typo with pvcreate
  
Actual results:
Lose all data on device.

Expected results:
Some kind of basic check to make sure the device isn't in use before
pvcreate is run.

Comment 1 Alasdair Kergon 2004-04-15 11:53:49 UTC
pvcreate already detects some situations like this and provides
warnings, e.g. if LVM is already using the device.  It also requires 
the partition type be set to the LVM type of '8e' indicating that the
device is meant to be controlled by LVM.

Was the partition type also set incorrectly (for the same reason)?  
Or was the '=f' argument to pvcreate used to suppress the warnings?

LVM itself is in maintenance-only mode now, so changes like this won't
happen I'm afraid.  Its replacement is LVM2 and I'll add this item to
its list of requested enhancements.  Additional checks like you
suggest are certainly possible.  There's already a low-priority item
on the list to take a backup of any parts of the device that pvcreate
changes.


Comment 2 Heinz Mauelshagen 2004-08-13 10:03:01 UTC
Duplicate.

*** This bug has been marked as a duplicate of 109887 ***