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 solve the problem of "insufficient disk space" in Linux

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

Share

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

This article mainly introduces "how to solve the problem of" insufficient disk space "in Linux. In daily operation, I believe many people have doubts about how to solve the problem of" insufficient disk space "in Linux. Xiaobian consulted all kinds of information and sorted out simple and easy operation methods. I hope to help you answer the doubts of" how to solve the problem of "insufficient disk space" in Linux "! Next, please follow the small series to learn together!

There is a lot of space left, but the Linux system still indicates that there is no space left. Why is this happening? Linux occasionally gets some frustratingly vague error messages, and this is one of them. However, these errors are usually caused by several factors.

Check disk space with du and df

*** Check to see if there really is space left on the disk before starting. While the desktop tools are great, the command-line tools are much more direct and better.

Linux Filesystem du

First let's look at the du command. Use it to check the mount point directory where the problem disk resides. This article assumes that the partition mount point in question is the root directory.

sudo du -sh /

Linux Filesystem df

Because it has to traverse all the files on disk, it takes a little while. Now let's try df again.

sudo df -h

Attach the root directory and the file system mounted in it to the end of this command. For example, if you have a separate disk mounted to/home, you need to add it to your root directory as well. The sum of the spaces used should be close to what you get with du. Otherwise, there may be deleted files occupied by processes.

Of course, the main focus here is on whether the results of these commands are smaller than the disk size. If it is smaller than disk size, then obviously there is a lot wrong.

Related: Using Agedu to analyze hard drive space usage

possible causes

Here are some of the main reasons for this. If you find a difference between du and df results, you can check the *** cause directly. Otherwise, start with the second cause.

Deleted file occupied by process

Sometimes a file may have been deleted, but a process is still using it. Linux does not free storage space for the file while the process is running. You need to find the process and restart it.

Check processes for deleted files

Use the following command to locate the process.

sudo lsof / | grep deleted

This should list the processes that are in trouble and restart them.

sudo systemctl restart service_namei nodes are not enough

Linux check filesystem inodes

File systems have metadata called "i node inode" that holds information about files. Many file systems have a fixed number of i-nodes, so it's likely that the i-nodes are exhausted and the file system itself isn't. You can use df to check.

sudo df -i /

Compare the number of i nodes used with the total number of i nodes. If there are no more i-nodes available, then unfortunately you can't extend i-nodes either. Delete some useless and outdated files to free up some i nodes.

ring block

*** A common problem is bad file system blocks. Unless otherwise marked, the operating system is likely to assume that these blocks are available, which can lead to file system corruption or hard drive death. *** is to use fsck with the-cc flag to search for and mark these blocks. Remember that you cannot use the fsck command in the file system you are using. You will need a live CD.

sudo fsck -vcck /dev/sda2

Obviously, you need to replace the disk location in the command with the disk path you want to check. Also, be aware that this may take a long time.

At this point, the study on "how to solve the problem of" insufficient disk space "in Linux" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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