undo LVM?

Luis Paulo luis.barbas at gmail.com
Thu May 6 14:53:58 UTC 2010


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 these LVM
>>> 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 used lvm in 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.
>
>> lvm was never asked to make a change or adjustment.
>>  (lvm was never activated beyond the initial installation)
>> Yes, the /HOME I am after is the my /HOME prior to lvm-install.
>
>> Luis/Dave: I still have a lot of 'lvm-studying' to do.
>>
>> My question is: What does lvm do when installed?
>> -lvm changes 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.
>> -does lvm alter the FAT upon installation? Can this be reversed?
>> -what else does lvm alter?
>
> LVM takes 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.
>
> LVM stores 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 find LVM is very useful because you can change filesystem sizes later.
> You can add a new disk to your system, give it to LVM as 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 use LVM and 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 use lvm may 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 a
lvm physical 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 of lvm/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 display lvm stuff 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 |grep lvm
ii  lvm2                                  2.02.39-0ubuntu11
           The Linux Logical Volume Manager

>> My question is: What does lvm do when installed?
As I said, hope it helps a little, nothing really new here.

>> -lvm changes 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

>> -does lvm alter the FAT upon installation? Can this be reversed?

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

>> -what else does lvm alter?

Oh, well... :)

Regards
Luis




More information about the ubuntu-users mailing list