How do I enlarge a Linux LVM disk volume?

…or “/var filled up! What do I do!?”

Check how much disk space you’ve got left, and how much you’re using:

 root@think:/home/eric#  pvs
  PV                VG       Fmt  Attr PSize  PFree
  /dev/scanner-sda5 think-vg lvm2 a--  <1.82t 1.04t
 root@think:/home/eric#  lvs
  LV     VG       Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home   think-vg -wi-ao---- <615.70g                                                    
  root   think-vg -wi-ao----   53.28g                                                    
  swap_1 think-vg -wi-ao----  <63.57g                                                    
  tmp    think-vg -wi-ao----   <1.86g                                                    
  var    think-vg -wi-ao----  <59.08g                                                    

Enlarge it

 root@think:/home/eric#  lvextend -L +10G /dev/mapper/think--vg-var
  Size of logical volume think-vg/var changed from <49.08 GiB (12564 extents) to <59.08 GiB (15124 extents).
  Logical volume think-vg/var successfully resized.
 root@think:/home/eric#  resize2fs /dev/mapper/think--vg-var
resize2fs 1.46.6-rc1 (12-Sep-2022)
Filesystem at /dev/mapper/think--vg-var is mounted on /var; on-line resizing required
old_desc_blocks = 7, new_desc_blocks = 8
The filesystem on /dev/mapper/think--vg-var is now 15486976 (4k) blocks long.

Categorized as Linux

Leave a comment

Your email address will not be published. Required fields are marked *