Raw Device, LVM and Oracle ASM (676 Views)
Reply
BFF
Member
BFF
Posts: 2
Registered: ‎06-07-2012
Message 1 of 4 (676 Views)

Raw Device, LVM and Oracle ASM

[ Edited ]

We had a raw device (disk115) that was presented to Oracle ASM.  This device was inadvertently used in LVM,  pvcreate was used to create the physical volume.  We want to re-present this disk back to Oracle ASM.  Is there a way to undo the pvcreate and make the LUN a raw device again?  This is a development server and Oracle DBAs are learning ASM.

Honored Contributor
Bill Hassell
Posts: 14,218
Registered: ‎05-29-2000
Message 2 of 4 (674 Views)

Re: Raw Device, LVM and Oracle ASM

All disk (LUN) devices have a raw and cooked device file. LVM simply initializes data on the disk (and destroys anything else that was on the disk (ie, Oracle). If the disk was incorprated into a volume group, you'll have to remove any logical volumes that are attached to this disk, then vgreduce the disk from the VG. Now the disk can be added to the Oracle definitions. If it already exists, it will need repair/rebuild using standard Oracle tools.

BFF
Member
BFF
Posts: 2
Registered: ‎06-07-2012
Message 3 of 4 (656 Views)

Re: Raw Device, LVM and Oracle ASM

The DBA told me he was unable to see the LUN after I did remove all LVs and did a vgreduce. What does pvcreate do to a LUN and how do you reverse it?
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 4 of 4 (648 Views)

Re: Raw Device, LVM and Oracle ASM

The pvcreate command creates an unique PVID for the new PV and initializes the LVM metadata at the beginning of the disk. It does not backup the data it overwrites. You can use the pvremove command to remove the LVM metadata, but the command has no way of restoring what was there before the pvcreate command was run.

 

According to some "cookbook" documents I found with Google, the beginning of the disk needs to be filled with zero bytes or ASM won't accept it (this prevents ASM from accidentally claiming disks that are already in use).

 

If the pvremove command is not enough to make the disk available to ASM again, you probably need to do something like this:

dd if=/dev/zero of=/dev/rdisk/disk115 bs=8192 count=12800

 The "cookbook" document referred to Oracle Metalink Note 268481.1 for more information regarding this command.

MK
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.