Reputation: 815
[root@ap-dcr-ctc01 log]# sudo vgs
VG #PV #LV #SN Attr VSize VFree
rhel 2 3 0 wz--n- 298.99g 0
As you can see the space directory of rhel-root is full so I would like to increase the space of its directory. How can I do it. By the way, this is rhel 7.3.This is the display for vgs and vgsdisplay. Also is it possible to transfer empty space in another directory to the root?(For home directory has 252G of available space so is it possible to transfer some to the root directory?)
Upvotes: 1
Views: 23759
Reputation: 340
First of all note this, XFS filesystem cannot be shrunk. Now the way to do this is as following:
Delete some unnecessary files from root so that you can store the backup of /home in this directory.
Backup the contents of /home as:
tar -czvf /root/home.tgz -C /home .
Test the backup
tar -tvf /root/home.tgz
Need to unmount /home
umount /dev/mapper/rhel-home
Remove home logical volume
lvremove /dev/mapper/rhel-home
Now need to recreate new /home LV (lets say of 100GB), format and mount it
lvcreate -L 100GB -n home rhel
mkfs.xfs /dev/rhel/home
mount /dev/mapper/rhel-home
Now extend your /root volume with all the remaining space
lvextend -r -l +100%FREE /dev/mapper/home-root
Restore your backup
tar -xzvf /root/home.tgz -C /home
Check /etc/fstab entry of /home. Update the UUID of /home directory
blkid /dev/mapper/rhel-home
vi /etc/fstab (and update UUID of /home)
Done !!! Hope it helps!!! :)
Upvotes: 2