The solution to the centos-root directory being full

When deploying docker on a virtual machine, it is found that the disk memory is full:

open /var/lib/dpkg/info/libc6:amd64.templates: no space left on device

1. Enter the df -h command to view the disk usage of the virtual machine, as shown in the figure:

 It can be seen that /dev/mapper/centos-root occupies 99%, which makes it impossible to write data

2. Enter cd / && du -hx--max-depth=1 to see which directory is too high, and adjust the contents of the too high directory

It can be seen that the ./cache file currently occupies the most memory. This is the occupation after I expanded and deleted the file. Before, the document occupied a lot. Find the document that takes up the most memory, enter the document, and then execute du -h -x --max-depth=1 to view the document that occupies the memory and delete unnecessary files.

3. Check whether there is still space occupied by the process after deleting the file.

Use the lsof  |grep delete statement to view the corresponding process number;

If so, use the kill -9 process number command to kill the process

 4. Virtual machine expansion

View the disk number command: ls /dev/sd*

 Create pv command: pvcreate /dev/sda4

 Adding pv to vg is equivalent to expanding vg: vgs extends vg, use gextend centos /dev/sda4 command

After expansion, use the lvs command to check 

 To extend lv, use the lvextend command: lvextend -L +20G /dev/mapper/centos-root

After the operation, re-read the system size: xfs_growfs /dev/mapper/centos-root

Enter df -h again to view the expansion

 

 

 

 

 

Supongo que te gusta

Origin blog.csdn.net/weixin_50143243/article/details/129867622
Recomendado
Clasificación