The following are the steps to expand the capacity of the Linux root directory. Follow you and you will be able to operate successfully.
First check whether the server is a lvm volume, if the lvm is followed by the document, please refer to other documents
1. Query disk
2. View disk usage
df -lh
3. Query Disk
fdisk -l
4. Create a logical partition
fdisk /dev/vda #/dev/vda这个是我的磁盘路径,根据实际情况操作
5. Refresh the disk partition
partprobe /dev/vda
6. Under View
lsblk
Here you can see that vda3 is created
7. Add the newly added volume to the volume group centos through vgextend
vgextend centos /dev/vda3
8. View creation information
vgdisplay centos
9. Expand capacity
Extend the root directory mount point /dev/mapper/centos-root through the lvextend command
lvextend -L +950G /dev/mapper/centos-root
Here I added 950G, and the expansion was successful when the above prompt appeared
10. Check whether it is successful
You can see that 950G has been added here
11. Refresh the next partition
xfs_growfs /dev/mapper/centos-root
12. Check whether the expansion of the disk is successful
In the red box, you can see that the disk has changed from 43G to 993G, indicating that the newly added 950G has been expanded successfully.