When I rebuilt my Debian laptop one of the security improvements I made was setting up root, home, var, and tmp as separate partitions. I guessed that /var would be good with 10Gb and recently it started complaining about running out of space on /var. Time to shrink /home by 10Gb and add that to /var.

The Steps

Make sure you have backups of your data before attempting this!!

  • Boot with a live USB
  • ctrl-alt-F3 # to get a console
  • sudo su - # to get root
  • fdisk -l /dev/nvme0n1 # my storage is on an nvme stick
  • cryptsetup luksOpen /dev/nvme0np3 myencvol # p3 is the disk partition that the lvm resides on
  • lvdisplay # see the logical volumes
  • e2fsk -fy /dev/dharma-vg/home # run a fisk to make sure everything is clean and compacted
  • resize2fs /dev/dharma-vg/home 885G # resize the partition; 885G is the size of home less the 10G
  • lvreduce -L -10G /dev/dharma-vg/home # reduce the logical volume size
  • resize2fs /dev/dharma-vg/home
  • vgdisplay # make sure the 10G is free
  • lvdisplay # to see the partition to expand in size
  • lvextend -L+10G /dev/dharma-vg/var # extend the logical volume by 10G
  • e2fsk -f /dev/dharma-vg/var # verify the partition
  • resize2fs /dev/dharma-vg/var

Comments? Email keith@nasman.us

- Keith Nasman