Register now and start sharing your code snippets.
-->

Resizing LVM partition that is on a crypted device.

Shell Script (Bash) posted 5 months ago by marko

I installed sysrescd on an USB stick to resize a partition that had too little space on it. The hitch was that it was on an encrypted partition. This is the correct order of the commands that needed to be issued.

sda3 is the encrypted device systemvg is the name of the volume group lv_usr is the name of the logical volume

   1  cryptsetup luksOpen /dev/sda3 crypt
   2  vgcreate systemvg /dev/mapper/crypt
   3  lvm vgchange --ignorelockingfailure -P -a y
   4  lvextend -L+2G /dev/systemvg/lv_usr
   5  e2fsck -f /dev/systemvg/lv_usr
   6  resize2fs /dev/systemvg/lv_usr

Tagged encrypted device, resize partition, lvm

Resize an LVM volume

Shell Script (Bash) posted about 1 year ago by marko

Step by step instructions on how an incorrectly configured /home was resized to 5Gb on one of our servers.

   1  umount /home
   2  e2fsck -f /dev/mapper/aktagon--1-home
   3  resize2fs /dev/mapper/aktagon--1-home 5G
   4  lvreduce -L 5G aktagon-1/home
   5  mount /home
First /home was unmounted as a precaution. Then the filesystem was fsck’ed. After that the file system was resized to 5Gb and finally the underlying LVM logical volume was resized.

Tagged resize partition, resize lvm, osion koon muokkaaminen, justering av partitionsstorlek