Bug 120909 - its possible to run pvcreate on a mounted disk, destroying all its data
Summary: its possible to run pvcreate on a mounted disk, destroying all its data
Status: CLOSED DUPLICATE of bug 109887
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: lvm   
(Show other bugs)
Version: 3.0
Hardware: All Linux
Target Milestone: ---
Assignee: Alasdair Kergon
QA Contact: Brian Brock
Keywords: FutureFeature
Depends On:
TreeView+ depends on / blocked
Reported: 2004-04-15 05:14 UTC by Mike MacCana
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-08-31 13:35:32 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

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):

How reproducible:

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

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

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

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