Resizing logical volumes with LVM on LUKS [closed]

asked 2018-10-30 15:17:13 -0500

ladlelord gravatar image

updated 2018-10-30 19:55:03 -0500

Hello, I'd like feedback on my steps for reducing my /home partition and expanding my /root partition before I run the commands. Are all my target devices and target partitions correct (e.g. /dev/mapper/lvg-home)? Do I need to resize my LUKS partition if all I have is one physical partition that LUKS encrypts? All my logical partitions are under one physical partition which is wrapped in LUKS. Am I missing anything important?

I'm using this question as my guide.

  1. Switch to a tty and log in as root since I will be unmounting /home.
  2. Unmount /home:
    • # umount /dev/mapper/lvg-home
  3. Run fsck on the unmounted system:
    • # e2fsck /dev/lvg/home
  4. Shrink /home filesystem using resize2fs:
    • # resize2fs /dev/lvg/home 199G
  5. Shrink the LVM home partition with lvreduce:
    • # lvreduce -L 200G /dev/lvg/home
    • will increase the filesystem to fill up the extra space
  6. Mount /home and check everything is OK.
  7. Enlarge the LVM parition that / lives in:
    • # lvextend -l +100%FREE /dev/lvg/root
  8. Enlarge filesystem to fill the LVM partition with resize2fs:
    • # resize2fs /dev/lvg/root

Some LVM info of my system:

$ sudo pvdisplay
  --- Physical volume ---
  PV Name               /dev/mapper/luks-xx0xxxxx0x0xx0x0xxxxxxxxx
  VG Name               lvg
  PV Size               <238.09 GiB / not usable 0   
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              60950
  Free PE               0
  Allocated PE          60950

$ sudo lvdisplay
  --- Logical volume ---
  LV Path                /dev/lvg/root
  LV Name                root
  VG Name                lvg
  LV Write Access        read/write
  LV Creation host, time localhost, 2018-08-10 17:19:06 -0400
  LV Status              available
  # open                 1
  LV Size                13.00 GiB
  Current LE             3328
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/lvg/swap
  LV Name                swap
  VG Name                lvg
  LV Write Access        read/write
  LV Creation host, time localhost, 2018-08-10 17:19:06 -0400
  LV Status              available
  # open                 2
  LV Size                10.00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/lvg/home
  LV Name                home
  VG Name                lvg
  LV Write Access        read/write
  LV Creation host, time localhost, 2018-08-10 17:19:06 -0400
  LV Status              available
  # open                 1
  LV Size                <215.09 GiB
  Current LE             55062
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by ladlelord
close date 2018-10-30 20:51:37.635112