Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to handle when the Linux server disk is full

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

In our daily work, it is a common problem that the server disk is full, so how can we deal with it logically and in a way?

First of all, when our server disk is full, what we usually think of is to delete the larger and unimportant files in order to free up space. Before that, we must understand one thing. That is the condition that a file needs to be deleted completely.

One is that the number of hard links in this file is 0.

Second, the number of processes occupied is 0.

All right, enough nonsense. Let's take a look at a case.

You can see that when I appended data to the file, I told me that there was no free space. At this time, let's use the df command to check the remaining space.

We found that the utilization rate of the root space is already 100%, so let's use du-sh to find out the occupancy of each directory under the root.

At this time, we can see that the / var/ directory is already very large. All right, let's go into this directory and find out the large files.

Finally, it is determined that the log file secure is too large. At this time, we empty the file and note that the log file should not be deleted directly using rm. It is best to make sure that the file is still useful before clearing it.

You can see that the log file has been emptied by us, and then we use the df command to see if the space has been released.

That's when we found that the space had been released.

Sometimes when we delete a large file, we find that the space has not been released. This is often because the deleted large file is occupied by a process. At this time, we can use lsof | grep "deleted" to see which process is occupying the file, and then restart the corresponding service. Of course, there may be other reasons, just wait for the partners to find out and share!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report