Prerequisites:
As shown in the figure above, the capacity of /root/app is full, and it is urgently needed to expand. An extra 96G of space is allocated from VMware and needs to be added to the /root/app directory.
Start operation:
1. fdisk -l view disk information
It is found that the total disk size is 210.5G, and 96G is not mounted. (The mosaic in the picture is sda4, because I cut the picture after finishing it. Normally there is no.)
2. fdisk /dev/sda starts partitioning
Then enter n p, press enter, and finally enter w to save
3. Then fdisk -l found more /dev/sda4
4. vgdisplay view volume group name
5. vgextend centos /dev/sda4 adds a new physical volume sda4 to the volume group centos to increase the capacity of the volume group
6. lvextend -l +100%FREE /dev/mapper/centos-home to extend the logical volume (or lvextend -L +96G /dev/mapper/centos-home)
7. Finally, use the resizefs2 command to reload the size of the logical volume to take effect.
resize2fs /dev/mapper/centos-home
If the file system is of type xfs, use the following command
xfs_growfs /dev/mapper/centos-home
8. Check again and find that the modification is complete and the capacity has increased
Pay attention to the problem:
1. If the mounted disk is busy, you can use the command to kill the program
fuser -cu /root/app View
fuser -km /root/app kill