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

What if the disk space is still insufficient after linux deletes the log file?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces the "linux delete log files after the disk space is still not enough to do" related knowledge, in the actual case of the operation process, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

Df-h view the usage of files in the system

Total capacity of Size partition

Size used by Used

The remaining size of the Avail

Percentage used by Use%

Mounted on path address

Under FreeBSD, when the hard disk capacity is full, you may see that the percentage used is more than 100%, because FreeBSD will leave some space for root, so that root can still write to the file system for management when the file system is full.

Du-sh * View the space occupied by each file and directory under the current directory

Size file name

4.0K test.txt

Du-h-- max-depth=1 / root/* check the directory and say there is a file size.

Du-h-- max-depth=1 / root lists all first-level directory file sizes under the root directory

Rm delete command

Rm-f * change to the directory you want to delete and delete all files in the directory

Rm-rf log/* deletes all files under the logs folder without deleting the folder itself

Causes and Solutions of inconsistency in disk size displayed by df-h and du-sh

Df-hT shows that 132g of space is fully occupied, while du-sh shows only 30g.

Cause of the problem

When you delete a file using the rm command, it will be deleted only if no link exists for the file

When a process accesses the file, the actual space occupied by the file will not be released

Du is the spatial statistics based on the file name, which is no longer visible to the system when using rm, so the file will not be counted.

Df is the actual number of disks occupied.

Solution method

Use the lsof | grep delete command to view the deleted files in use, and find that there are multiple such files. Kill dropped the process, and the file was deleted successfully.

Details: https://blog.csdn.net/c_z_w/article/details/89226241

This is the end of the introduction of "what to do after linux deletes the log file and there is not enough disk space". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Internet Technology

Wechat

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

12
Report