Hapus partisi home dan extend partisi root (CentOS 7)

 


  1. Copy home folder

    cp /home /home-bak

  2. Unmount home partiton

    umount /home

  3. Show logical volumes and look for the home volume

    lvdisplay

    output

    .
    .
    — Logical volume —
    LV Path                      /dev/myhost/home
    LV Name                   home
    VG Name                  centos
    .
    .

  4. Remove the home volume

    lvremove /dev/myhost/home

  5. Verify that you have free space.

    vgs

  6. Take note of where your root is located

    df -h

    output

    Filesystem Size Used Avail Use% Mounted on
    /dev/mapper/myhost-root 50G 1.2G 49G 3% /
    .
    .

  7. Resize root partition to reclaim all free space.

    lvextend -l +100%FREE /dev/mapper/myhost-root
    resize2fs /dev/mapper/myhost-root

    OR

    lvresize –resizefs -l +100%FREE /dev/mapper/myhost-root

  8. Remove the line containing the home directory from /etc/fstab
  9. Reboot.