This process requires that you are able to ssh OR log in locally using the root user account and that no services be running as users out of /home on the target machine.
The examples are from a default installation with no customization-you NEED to know what you're working with for volumes/partitions to not horribly break things.
By default, CentOS 7 uses XFS for the file system and Logical Volume Manager (LVM), creating 3 partitions: /
,/home
and swap.
NOTE: If you want to be sure that nothing is writing to /home
you can either modify the host to boot into single-user mode OR try to use the
systemctl isolate runlevel1.target
command to switch (not tested! should work).
To backup the contents of /home, do the following:
mkdir /temp
cp -a /home /temp/
Once that is finished at your back at the prompt, you can proceed to step 2.
umount -fl /home
We run the lvs
command to display the attributes of the LVM volumes
lvs
Sample output:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home cl -wi-a----- 406.94g
root cl -wi-ao---- 50.00g
swap cl -wi-ao---- 7.81g
lvremove /dev/cl/home
Based on the output of lvs
above, I can safely extend the root LVM by 406GiB.
lvextend -L+406G /dev/cl/root
xfs_growfs /dev/mapper/cl-root
cp -a /temp/home /
rm -rf /temp
Using your preferred text editor, ensure you open /etc/fstab
and remove the line for /dev/mapper/cl-home.
Run the following command to sync systemd with the changes.
dracut --regenerate-all --force
Thanks you ,very clear guide !!
I would like to do it also with my CENTOS8 KVM server .
I have only 50G in /dev/mapper/cl-root and only 5G are free .
So there is not enough space to add more machines there ,
while in : /dev/mapper/cl-home I have 504G available ,which is a lot of wasted disk space I am no using .
Just want to make sure all this process is safe .
Could you please tell me , if there is data loss risk on cl-root partition , where all my machines are stored , 10xx