Notes LVM

Voir :

boot-lvm-grub

lvm_changement_remplacement_de_pv

vm_creation_fs_lvm_a_chaud

snapshot_lvm

lv_attrs

man 8 lvs

Extents are the smallest units of space that you can allocate in LVM. Physical extents (PE) and logical extents (LE) has the default size of 4 MiB that you can configure. All extents have the same size. When you create a logical volume (LV) within a VG, LVM allocates physical extents on the PVs

Création LVs

lvcreate -l 100%FREE -n newlv vg_data

Script - get size lv_size & vgfree space

lvs --readonly --noheadings --nosuffix --units=m /dev/mapper/applivg-lv_plop -o lv_size vgs --readonly --noheadings --nosuffix --units=m applivg -o vgfree

Pb

# pvcreate /dev/sda3
Device /dev/sda3 not found (or ignored by filtering).

# pvcreate -vvv /dev/sda3 2>&1 | grep '/dev/sda3'
/dev/sda3: Skipping: Too small to hold a PV

Tags

vgchange --deltag T9 --deltag T10 --addtag T13 --addtag T14 grant pvs -o pv_tags /dev/sda2 vgs -o vg_tags /dev/VolGroup00 lvs -o lv_tags /dev/VolGroup00/LogVol00

Use the following command to list all the logical volumes with the database tag

lvs @database

Use the following command to list the currently active host tags

lvm tags

Autres

Resize the PV when some data was allocated at the end of the LVM.

pvs -v --segments /dev/sda5 pvmove --alloc anywhere /dev/sda5:yyyy-end pvs -v --segments /dev/sda5