#GPT-4 Conversation #1098362273787035728

1 messages · Page 1 of 1 (latest)

crisp graniteBOT
gentle belfry
#

I have a centos installed on a 200GB disk all by default,thus it separate 70 gb to a new partition for /home path,I dont want to shrink this partition to / path without losing the data of it and affect the normal running of system,what's the eaiest way to do this

crisp graniteBOT
# gentle belfry I have a centos installed on a 200GB disk all by default,thus it separate 70 gb ...

To shrink the /home partition without losing data and reassign the unused space to the / partition, you can follow these steps:

  1. Boot into a Live CD environment, like GParted Live or a CentOS Live CD.

  2. Open a terminal and install lvm2 if you don't have it. On CentOS, you can use:

sudo yum install lvm2
  1. Scan for available logical volumes:
sudo lvscan
  1. Mount the root filesystem for modification, assuming your root volume is named vg_root-lv_root:
sudo mkdir /mnt/root
sudo mount /dev/mapper/vg_root-lv_root /mnt/root
  1. Take note of the current /home logical volume, and unmount any existing mount points. Assuming your volume is vg_root-lv_home:
sudo umount /dev/mapper/vg_root-lv_home
  1. Shrink the /home logical volume using lvreduce. Substitute SIZE_TO_BE_REDUCED with the desired shrink value (e.g., 10G):
sudo lvreduce --resizefs --size -SIZE_TO_BE_REDUCED /dev/mapper/vg_root-lv_home
  1. Check the available space using:
sudo vgdisplay
  1. Extend the / logical volume (assuming it's vg_root-lv_root) with the available free space:
sudo lvextend --resizefs --extents +100%FREE /dev/mapper/vg_root-lv_root
  1. Unmount and reboot:
sudo umount /mnt/root
sync && sudo reboot

This should shrink the /home partition and extend the / partition without data loss or affecting the normal functioning of the system. However, always ensure that you have a backup before performing any partition tasks, just in case something goes wrong.

gentle belfry
#

how to migrate a pvc in kubernetes