Friday, January 12, 2024

Reduce /home and Add SWAP space in Centos 9

dnf install xfsdump
dnf install xfsrestore

 umount /home

xfsdump -f home.bkup /dev/mapper/ol-home

lvchange -an /dev/ol/home

 lvremove /dev/ol/home

 lvcreate -L 30G -n home ol

mkfs.xfs /dev/ol/home

 mount -a

 df -h


 xfsrestore -f home.bkup /home

ls /home

   df -h

 lvcreate -L 4G -n swap ol

  mkswap /dev/ol/swap

  swapon /dev/ol/swap

  echo "/dev/ol/swap swap swap defaults 0 0" >> /etc/fstab

free