[linux-lvm] Total free space using added VGs and LVs

Luca Berra bluca at comedia.it
Fri Oct 23 06:52:20 UTC 2009

On Wed, Oct 21, 2009 at 03:03:24PM -0400, Lou Arnold wrote:
>I read the How-To. It doesn't talk about the specific case or being mounted
I hate how-tos, they are a collection of particular cases and leave the
luser with a feeling of knowledge. which is not.

>at root, so I had to experiment. It is likely that commands were in the
>wrong order, but I don't know what the right order is.
>I have attached the terminal session I used. In the end it did not work.

the commands were not in the wrong order,
they were just the wrong commands, unless your aim was reinstalling.

>There was still 66 GB free, and when I rebooted, the file system failed. The
>superblock was too big.
>I obviously don't understand the difference between pvresize, lvreduce and
>vgreduce, and how  resize2fs  is related to these commands.

I think you need to go over the basics again
LVM is used to abstract storage management
it is done by creating layers
Physical Volumes: which represent disks (or partitions, or whatever
block device...)
Volume Group: which is a collection of disks
Logical Volume: which is a portion of a volume group

LVM allows to add/remove PVs to/from a VG. Add/remove/increase/shrink
LVs in a VG.
This is done by dividing each PV in Physical Extents (PE), and then
mapping those to Logical Extenst (LE) in a LV, so a LV is composed of
chunks of disk taken from one or more PV in a VG.

When using lvm you create filesystems over logical volumes instead of
creating them on disk (or partition....)

Lvm has no knowledge of what lays over it, a logical volume
is just a block device.

The above sentence means that if you use a logical volume to host a
filesystem and want to resize the lv, you have to deal with the
filesystem yourself.
if you enlarge a LV, you have to tell the filesystem that the space
available has increased.
if you want to reduce an LV, you have to ensure _before_ doing it that
the space removed does not contain any data.
so if you want to reduce an LV containing a filesystem you _have_ to
tell the filesystem _before_ to let that space alone. if you fail to do
this you will loose all data that was on the portion of disk you
removed, and the filesystem will still think it can use that portion of
data, until it will actually try, then sudden realization will hit like
a brick. as you just discovered.

btw, let pvresize alone, it is used only in the particular case in which
you are able to resize the disk underlying a volume group, which is
impossible for a plain disk.


More information about the linux-lvm mailing list