1752754 Members
5296 Online
108789 Solutions
New Discussion юеВ

LVM pvcreate

 
SOLVED
Go to solution
Nath_3
Frequent Advisor

LVM pvcreate

Hi,

Does pvcreate -f deletes the data on the disk? I am using oracle raw logical volumes.

Thanks

10 REPLIES 10
R.K. #
Honored Contributor

Re: LVM pvcreate

Hi Nath,

"pvcreate -f" will NOT delete the data. It will only remove the headers on the disk.
If you have VG backup files (created from vgcfgbackup, normally inside /etc/lvmconf/ directory), then you can revert back (by "vgcfgrestore") and get the disk working as before.

-RK
Don't fix what ain't broke
Jeeshan
Honored Contributor

Re: LVM pvcreate

yeah, absolutely.

whenever you apply command pvcreate, it deletes all the previous data reside in it and clean the disk as like as new disk.
a warrior never quits
sujit kumar singh
Honored Contributor

Re: LVM pvcreate

hi


the pvcreate is a destructive command that writes the necessary LVM Structures on a disk and after that we add the disk to a VG using vgcreate or vgextend.

used with -f option this deletes the earlier LVM structures on the disk and creates the new one.

LVM structures on a disk are the metadata structures that are used to keep all the informations regarding the LV, VG ,PV, data area , boot area etc.

So all the LVM related information is gone.
that means that u can further do not read any data on the disk.the disk becomes as good as an empty or new disk.


Regards
Sujit
avizen9
Esteemed Contributor

Re: LVM pvcreate

HI Nath,
i had done this before,
it will remove all your information from that physicall HDD (LVM , VG)

you can not recover all info again. tq
Solution

Re: LVM pvcreate

you gotta love it when you get completely different answers to these sorts of questions. Guys if your not *completely* sure, say so!

For the record RK has it right. pvcreate overwrites the reserved area at the start of a disk that contains LVM metadata. The actual remaining data on disk is left untouched, and you *should* be able to get it back if you have a backup of the LVM headers in /etc/lvmconf. vgcfgrestore can be used to do that.

Now if you've accidently run a pvcreate -fB on a data disk that wasn't previously bootable, you could really lose data, as the -B option makes the reserved area bigger to provide space for the boot LIF areas. If the disk wasn't previously used for boot, then the first few LVM extents could get overwritten.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
R.K. #
Honored Contributor

Re: LVM pvcreate

Hey Duncan,
Nice piece of info about "pvcreate -Bf".
A good point to take care of.
:)
Don't fix what ain't broke
surendranath
Advisor

Re: LVM pvcreate

Is this the same even when data resides on block logical volume?
Nath_3
Frequent Advisor

Re: LVM pvcreate

Thanks for the info. I agree with RK and Duncan. And i did a pvcreate -f on a disk and i could get back the all the data.

One more Question regarding the same:

Is this the same even when data resides on block logical volume?

Thanks
Ravi
Torsten.
Acclaimed Contributor

Re: LVM pvcreate

Everything said applies to each LVM physical volume - no matter what is inside the logical volumes.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!