Last update at :2023-12-13,Edit by888u
Many times we rarely go back and log in to the backend to check whether the hard drive capacity is sufficient, and we rarely pay attention! Generally, you only pay attention when relevant code prompts appear! When creating a file in the system, a prompt of insufficient space appears: "No space left on device..." This means that the space is not enough, there is no extra meaning!
Solution process:
Linux system space is full. Common reasons include:
(1) The partition capacity is full;
(2) Partition inode exhaustion;
(3) Zombie files: The corresponding space of deleted files is not released because the handle is occupied but not released.
The processing ideas for the above three situations are explained as follows:
1. Partition capacity is full - space usage analysis
a) Use the following command to check the space usage
- # df -hT
- Filesystem Type Size Used Avail Use% Mounted on
- tmpfs tmpfs 16G 228K 16G 1% /dev/shm
- /dev/sda1 ext4 477M 59M 393M 13% /boot
b) Use the following command to analyze the space usage of each directory layer by layer
- # du -m –max-depth=1 |sort -gr
Enter the directory that takes up the most space layer by layer, continue to execute the above instructions, gradually locate the files or directories that occupy too much space, and then clean them accordingly.
2. inode capacity is full - inode usage analysis
a) Use the following command to check inode usage
- # df -i
b) Use the following command to analyze inode usage
- for i in /*; do echo $i; find $i | wc -l; done
Enter the directory with the highest inode occupation layer by layer, continue to execute the above instructions, gradually locate the files or directories that occupy too much space, and then clean them accordingly.
3. Zombie file analysis
a) Use the following command to view the file zombie files and their space usage that have been deleted but whose handles have not been released:
- # for i in `lsof | grep delete | awk -F” “‘{print $9}’` ;do du -h $i;done | sort -gr
b) Use the following command to find the process ID of the above zombie file
- # for i in `lsof | grep delete | awk -F” “‘{print $9}’` ;do du -h $i;done | sort -gr
c) Use the following command to view the corresponding process information:
- ll /proc/[size=font-size:9.0pt,9.0pt]
/exe - [size=font-size:9.0pt,9.0pt]For example:
- # ll /proc/10835/exe
d) After restarting the corresponding process, the corresponding handle can be released and the occupied space can be released.
Recommended site search: server, how much does server defense cost, space service provider, website space provider, php space application, renting a server permanently free linux server, Zhengzhou server hosting, applying for free space and domain name, dynamic dial-up vps host,
p>
发表评论