LVM

Create LV

  • Display all PVs, VGs and LVs:
    sudo pvs; sudo vgs; sudo lvs;
  • Verify devices in /dev/sd*:
    ll /dev.sd*
  • Create PV:
    sudo pvcreate /dev/sdb
  • Create VG:
    sudo vgcreate <vg_name> <pv>
  • Create LV:
    sudo lvcreate -l 100%FREE -n <lv_name> <vg_name>
  • Format LVM partition:
    sudo mkfs.xfs /dev/<vg_name>/<lv_name>
  • Mount LVM:
    sudo mount /dev/<vg_name>/<lv_name> <mnt_destination>
  • Add LVM to fstab:
    echo '/dev/<vg_name>/<lv_name> <mnt_destination>  xfs  defaults 0 0' | sudo  tee -a /etc/fstab ; sudo mount -a

Upscale LV

  • Upscale the managed disk (Azure).
  • Extend the PV:
    sudo pvresize /dev/sd*
  • Extend the LV:
    sudo lvextend -l +100%FREE /dev/VGName/LVName
  • Resize the filesystem:
    sudo xfs_growfs /mount/point