This is an old revision of lvm from 24.02.2018 11:58 edited by EvaggelosBalaskas.
lvm basics
Contents
- physical volumes
- volume groups
- logical volumes
- Create a new LVM partition
- extend an lvm partition
- reduce
physical volumes
# pvs PV VG Fmt Attr PSize PFree /dev/sda2 vg_790 lvm2 a-- 465.52g 211.52g
list physical volumes
# pvdisplay # pvdisplay -C
volume groups
# vgs VG #PV #LV #SN Attr VSize VFree vg_790 1 10 0 wz--n- 465.52g 211.52g
list all volume groups
# vgscan # vgdisplay # vgdisplay -C
activate all
# vgchange -ay
deactivate a specific volume group
# vgchange -an vol_group_1
activate all logical volumes on a volume group, only
# vgchange -ay vol_group_1
logical volumes
list logical volumes
# lvs # lvdisplay -C
Create a new LVM partition
# lvcreate -L 10G -n /dev/vg_group01/lv_vol01 # mkfs.ext4 -L lv_vol01 /dev/vg_group01/lv_vol01 # mount /dev/vg_group01/lv_vol01 /media/
extend an lvm partition
How to extend an lvm partition:
umount /opt/dnl lvextend -L +5G /dev/vg01/dnl e2fsck -f /dev/vg01/dnl resize2fs /dev/vg01/dnl mount /opt/dnl/
reduce
# lvresize -l +100%FREE -n /dev/vg01/backup
umount
check filesystem
# lvresize -l +100%FREE -n /dev/vg_xps/lv_Breach Size of logical volume vg_xps/lv_Breach changed from 5.00 GiB (1280 extents) to <6.97 GiB (1784 extents). Logical volume vg_xps/lv_Breach successfully resized.
resize2fs filesystem
# xfs_growfs /opt/Breach