undo LVM

Tom H tomh0665 at gmail.com
Mon May 17 23:32:39 UTC 2010


On Sun, May 16, 2010 at 6:06 PM, Michel Racic <michel.racic at gmail.com> wrote:
> 2010/5/16 Tom H <tomh0665 at gmail.com>:
>> On Sun, May 16, 2010 at 4:21 PM, Michel Racic <michel.racic at gmail.com> wrote:
>>>
>>> Someone on #LVM channel (freenode) meant that pvremove could help as
>>> it wipes the LVM headers for that disc if I used pcvreate for the
>>> creation.
>>>
>>> Does someone know what exactly the alternate installer does on the
>>> step in manual partition if you create a LVM group and ad a disk to
>>> it?
>>
>> I have not followed this thread from the beginning so I am only
>> commenting on the post above.
>>
>> If you want to run pvremove make sure that you precede it with a
>> pvmove and vgremove.
>>
>> If you are creating a VG manually (and I assume that the installer
>> does this in the background), you
>> - run pvcreate to turn a partition into an LVM physical volume
>> - run vgcreate to add the newly created PV to a VG (or vgextend if
>> adding a PV to an existing VG)
>> - run lvcreate to carve out a logical volume in that VG
>>
>> If you want to remove a partition from a VG, you
>> - run pvmove to move any data ("physical extents") from that PV to another PV
>> - run vgreduce to remove that PV from the VG
>> - run pvremove to remove that PV from LVM
>>
>> Just running pvremove will not work - or if does work, will leave you
>> with an LVM mess.
>
> Thanks for explaining the process of manual LVM setup.
> Just to repeat the facts, vgdisplay and pvdisplay show the partition
> but lvdisplay doesn't have any output.
> This seems to me that the installer did just the step with pvcreate
> (which wrote the LVM headers to my encrypted disc) and vgcreate which
> added the pv to a group but the last step with creating a logical
> volume hasn't been done by the installer because I aborted the
> installation as soon as I saw the mess I created.
>
> You suggest pvmove to move any data but I think that is meant if the
> pv actually was used in an LVM setup or did I get that wrong?
>
> I don't use the VG that this PV is in, so I don't care about the LVM
> stuff (in the meaning it is not a disc I want to take out of a
> productive LVM setup) but I need to get to the data on that disk and
> its a ext3 FS but encrypted with Luks.
>
> Just to get my situation from the Thread:
> The disc was in use as a Luks encrypted partition and I just
> accidentaly added it to a LVM group but if I open the device in
> hexedit I see that the Luks header should still be OK but I don't know
> how to recover the partition header that I can mount it again with
> cryptsetup.

You're welcome.

lvdisplay not returning anything is a good sign that you don't have
any data on the PV/VG/PV. But to check whether a PV has any data, it
is best to use pvdisplay and check the Total PE/Free PE/Allocated PE
values.

The procedure that I emailed you was not verbose enough... If you have
at least another PV and you are using PEs on a PV, you have to run
pvmove before vgreduce and pvremove.

I have absolutely no experience with disk encryption, but since you
can still see the LUKS header, you should be able to run pvremove
without disturbing it. You should dd the partition/disk (including its
MBR especially if it's a disk), and run a test.




More information about the ubuntu-users mailing list