How do I check / modify LVM state on a pre-installed system?
Solution 1:
LVM is a pretty complex system and requires some knowledge before you can fully start to inspect the state. There are quite a few howtos lying around on the subject, but here is a crash course:
First of all, LVM is structured so that you pool physical partitions or volumes in to groups that then get split to logical volumes that are used by the operating system. All of these can be inspected with their own set of tools. Physical partitions (or volumes) can be inspected and modified with the pv* tools. Volume groups are inspected and modified with the vg* tools and finally the actual volumes that are used as filesystems can be inspected with lv* toolset.
Here is a good example on LVM structure
For inspecting the state of LVM you can use lvs
, vgs
or pvs
commands. This will allow you to see how much space is used and where that space is allocated.
You can alter the size of logical volumes with the lvresize
command, but be very careful when doing so. The LVM doesn't allow data to be stored outside of the logical volume like regular partitions. So if you shrink a partition by mistake and make it smaller than the filesystem, you will loose the data outside of the partition. Also when you resize a partition you need to resize the filesystem too, it is not automatically resized.
Finally, here is a full LVM HOWTO covering the bits I've left out here.
LVM is really powerful and useful. Once you get to know it, you don't really want to use anything else.