tech:notes_lvm
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_lvm [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_lvm [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes LVM | ||
| + | |||
| + | Voir : | ||
| + | * [[boot-lvm-grub]] | ||
| + | * [[lvm_changement_remplacement_de_pv]] | ||
| + | * [[vm_creation_fs_lvm_a_chaud]] | ||
| + | * [[snapshot_lvm]] | ||
| + | |||
| + | lv_attrs | ||
| + | ~~~bash | ||
| + | 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 | ||
| + | |||
| + | ~~~bash | ||
| + | lvcreate -l 100%FREE -n newlv vg_data | ||
| + | ~~~ | ||
| + | |||
| + | ## Script - get size lv_size & vgfree space | ||
| + | |||
| + | ~~~bash | ||
| + | lvs --readonly --noheadings --nosuffix --units=m / | ||
| + | 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: Skipping: Too small to hold a PV | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Tags | ||
| + | |||
| + | ~~~bash | ||
| + | vgchange --deltag T9 --deltag T10 --addtag T13 --addtag T14 grant | ||
| + | |||
| + | pvs -o pv_tags /dev/sda2 | ||
| + | vgs -o vg_tags / | ||
| + | lvs -o lv_tags / | ||
| + | ~~~ | ||
| + | |||
| + | Use the following command to list all the logical volumes with the database tag | ||
| + | ~~~bash | ||
| + | lvs @database | ||
| + | ~~~ | ||
| + | |||
| + | Use the following command to list the currently active host tags | ||
| + | ~~~bash | ||
| + | lvm tags | ||
| + | ~~~ | ||
| + | |||
| + | ## Autres | ||
| + | |||
| + | Resize the PV when some data was allocated at the end of the LVM. | ||
| + | |||
| + | ~~~bash | ||
| + | pvs -v --segments /dev/sda5 | ||
| + | pvmove --alloc anywhere / | ||
| + | pvs -v --segments /dev/sda5 | ||
| + | ~~~ | ||
| + | |||
| + | |||
