====== Ubuntu - LVM - Troubleshooting LVM ======
===== Errors =====
==== Logical volume already exists in volume group ====
You cannot create two logical volumes of the same name in the same volume group. An error of the form:
Logical volume "foo" already exists in volume group "vg01"
indicates that you are attempting to do so.
----
==== Logical volume not found ====
An error of the form:
Logical volume foo not found in volume group vg01
could indicate that:
* you have specified the wrong pathname for the logical volume, or
* the logical volume that you intended to specify has been deleted, or
* one or more physical volumes were not found during discovery (in which case the volume group will also be missing).
To establish what has happened you can request a list of logical volumes in the volume group:
lvdisplay /dev/vg01
then if necessary a list of volume groups known to the system:
vgdisplay
and a list of physical volumes known to the system:
pvdisplay
----
==== Insufficient free extents in volume group ====
An error of the form:
Insufficient free extents (55211) in volume group vg01: 128000 required
or:
Insufficient free space: 128000 extents needed, but only 55211 available
while attempting to create or extend a logical volume indicates that the volume group does not have enough free space to satisfy your request.
Your options are:
* to use a different volume group, if you have one with more space, or
* to delete one or more existing logical volumes to free up space within the volume group, or
* to add one or more physical volumes to the volume group to make it larger, or
* to reduce the amount of storage space that you are requesting.
You can determine how much free space is available within a given volume group using the **vgdisplay** command:
vgdisplay /dev/vg01
which produces output of the form:
--- Volume group ---
VG Name vg01
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 14
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 8
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 3.73 TB
PE Size 4.00 MB
Total PE 976811
Alloc PE / Size 921600 / 3.52 TB
Free PE / Size 55211 / 215.67 GB
VG UUID TkxRBk-j2Mo-Mq1a-GzTx-DKdx-2oHJ-m2o6Ua
The amount of free space is the second value given on the line labelled 'Free PE/Size' (215.67 gigabytes in the example above).
----
==== New size not larger than existing size ====
An error of the form:
New size given (1536 extents) not larger than existing size (2048 extents)
Run `lvextend --help' for more information.
when running **lvextend** indicates that you requested a final size that was smaller than the current size of the volume. This is a safety feature: shrinking a volume when you intended to expand it would be likely to cause irreparable data loss.
If you really did mean to reduce the size of the volume then you should use **lvreduce** or **lvresize** instead.
----
===== Warnings =====
==== Rounding up size to full physical extent ====
LVM allocates storage in multiples of the physical extent size, which is 4MB by default. If you request a size that is not an exact multiple (for example, 255MB) then it will display a warning of the form:
Rounding up size to full physical extent 256.00 MiB
This will not usually cause any significant harm beyond using slightly more space than intended. However, be aware that a filesystem subsequently created on this volume will (typically by default) fill the whole 256MB that has been allocated. This could be a problem if you had a specific requirement to create a filesystem that was no larger than 255MB (perhaps because it was intended to be copied to some other medium with limited capacity).
----
===== References =====
* http://www.tldp.org/HOWTO/LVM-HOWTO/