undo LVM

Michel Racic michel.racic at gmail.com
Sat May 15 22:47:05 UTC 2010


Hi Luis

Did you get a solution for your problem?

I made the same (similar) mistake...
I have a 1TB Data disk that is encrypted with luks (cryptsetup) and I
installed a new SSD disk because my old HD has crashed and wanted to
install lucid lynx on it.
On the partition screen I accidentally added the encrypted partition
to the LVM and have seen it after I accepted the writing of the
partition table to the disk.
Now I have the problem how to revert the LVM part that I can decrypt
my luks partition with cryptsetup again.

Could you manage reverting LVM to get to your data or finishing LVM
without deleting the content of that disk?

Best regards

Michel


---------- Forwarded message ----------
From: Luis Paulo <luis.barbas at gmail.com>
Date: 6 Mai, 16:53
Subject: undo LVM?
To: ubuntu-users-archive


On Thu, May 6, 2010 at 2:24 PM, Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk> wrote:
> Herman Aalderink wrote:
>> On Thu, 2010-05-06 at 11:38 +0100, Dave Howorth wrote:
>>> Herman Aalderink wrote:
>>>  > hermanbb at tabang1:~$ sudo lvdisplay
>>>> hermanbb at tabang1:~$ sudo lvdisplay
>>>> hermanbb at tabang1:~$

>>>> hermanbb at tabang1:~$ sudo lvscan
>>>> hermanbb at tabang1:~$ sudo lvscan
>>>> hermanbb at tabang1:~$

>>>> I dont get a response with either cmd.
>>> Herman, am I right in thinking that you have previously used theseLVM
>>> volumes and you believe they have data in them? If so, the following
>>> might help.

>> This is the first time I heard the term 'lvm'.
>> This is the first time I usedlvmin my system.
>>  'lvm' came up when installing Ubuntu 10.04LTS Alternate 64-bit.
>>  (I thought it was about 'Linear Addressing' of large harddisks as I
>> used to do in the BIOS, LBA?)

> Ah, OK. That makes the problem much simpler and easier. Ignore my
> previous suggestion then.

>>lvmwas never asked to make a change or adjustment.
>>  (lvmwas never activated beyond the initial installation)
>> Yes, the /HOME I am after is the my /HOME prior tolvm-install.

>> Luis/Dave: I still have a lot of 'lvm-studying' to do.

>> My question is: What doeslvmdo when installed?
>> -lvmchanges the first sector(?) on every partition.
>>   (can this be reversed?)
>>   As is, no program or OS recognizes (the partition as partition),
>> except a partition-editor.
>> -doeslvmalter the FAT upon installation? Can this be reversed?
>> -what else doeslvmalter?

>LVMtakes over the partitions that you assign to it, which it calls
> physical volumes. You collect these into one or more 'volume groups' -
> you've got exactly one, called 'hill60'. Then you create virtual
> partitions, which it calls 'logical volumes' inside those and finally
> you create normal filesystems in the logical volumes.

>LVMstores its own control data plus your filesystem data in the
> partitions. You don't really need to worry about how exactly - I don't
> know, for example.

> I findLVMis very useful because you can change filesystem sizes later.
> You can add a new disk to your system, give it toLVMas a new physical
> volume and then use its space to extend an existing filesystem, for
> example. So you never need to worry about running out of space.

> [...]

> On the other hand, if you decide not to useLVMand you want to remove
> it, you just reformat the partitions with whatever format you want to use.

> Cheers, Dave

Hi, herman

I'm hoping if I tell you how I uselvmmay complement what Dave
explained. I'll lie or omit a little just to keep it simple. Hope you
can forgive that

I installed a fresh system in 3 partitions (/boot, / and swap) and was
left with 120G of disk free space. I want to use it for /home and for
/var/lib/libvirt (storage of virtual machines)

I could jcreate 2 new partitions (logical, probably) for it and mount
them. But then I have to decide how big each one will be.
Instead I created a mdadm raid 1 with the free 120G and turned into
alvmphysical volume
$ sudo pvcreate /dev/md2
$ sudo vgcreate vgraid1 /dev/md2
Note: I never had to do vgchange -a y vgraid1 to activate it. I guess
something did it for me.

Now I may create 2 logical volumes, each with the size I need now (not
having to care about how I will need in the future) leaving the rest
free for growing when needed (extend)
$ sudo lvcreate -L5G -nhome vgraid1
$ sudo lvcreate -L40G -nlibvirt vgraid1

The ability to extend those volumes depend on the filesystem. I use xfs, so
$ sudo mkfs.xfs /dev/mapper/vgraid1-home (or use the link: sudo
mkfs.xfs /dev/vgraid1/home)
and $ sudo mkfs.xfs /dev/vgraid1/libvirt

and just mount them on fstab

If I need now a 10G home, I'll do
$ sudo lvextend -L10G /dev/vgraid1/home (take a look at other options,
specially -l option)
$ sudo xfs_growfs /dev/vgraid1/home

I can still use the remaining free space to create other volume, say
for example, a /dev/vgraid1/backup

The great thing is that if I exaust the 120G and need more, I can
simply attach a new disk - or two :), make it (or part of it) a
physical volume, add it to vgraid1 with vgextend, and lvextend my
existing logical volumes into it as I did before.

Done. I think thats the very basic usage oflvm/raid/xfs. Say that
because there are a number of options for those commands you may had
use, there's mapping modes (linear/striped), snapshots, ...

A tool to graphical displaylvmstuff is
$ sudo apt-get install system-config-lvm
(at least on gnome and ubuntu 9.10)

More notes:
* You may of course have more than one vg. I have also a vgraid0 with
swap and /var
* My / is also on vgraid1, /boot is just a raid 1 device
* I usually format my raid devices before turning them into physical
volumes. It seems I get less system warnings. (?)
* I'm using lvm2
$ dpkg -l |greplvm
ii  lvm2                                  2.02.39-0ubuntu11
           The Linux Logical Volume Manager

>> My question is: What doeslvmdo when installed?

As I said, hope it helps a little, nothing really new here.

>> -lvmchanges the first sector(?) on every partition.
>>   (can this be reversed?)

Not that I know of, it might... Changes UUID?

>>   As is, no program or OS recognizes (the partition as partition),
>> except a partition-editor.

partition only exists at the physical volume level

>> -doeslvmalter the FAT upon installation? Can this be reversed?

Notlvm, I think. Reformat the disk, for example, and start fresh,
right? But copy the contents out first :)
You can always removellvm(or had not installed it)

>> -what else doeslvmalter?

Oh, well... :)

Regards
Luis

--
ubuntu-users mailing list
ubuntu-users at lists.ubuntu.com
Modify settings or unsubscribe
at:https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




More information about the ubuntu-users mailing list