Linux hard disk is full of how to handle

Source: Internet
Author: User

First, determine if it is true that there is not enough disk space

Input command: DF–LH view disk information

It is obvious that the 40G capacity under the mount point/dev/xvda1 under filesystem is exhausted.

Now that the problem is fixed, the next step is to deal with it.

The processing method is also very simple, that is, delete the document.

Q: What files are deleted?

A: Delete files that occupy large, but useless, disk space.

Q: What is a useless file?

A: If you are unfamiliar with the system, the log may be your first target.

Second, how to locate the largest file directory

Enter the command: CD/Enter the root directory.

Input command: du-h max-depth=1 Find the current directory, which folder occupies the largest space

After the above two commands, you can see the/usr this path takes up a large disk space and consumes 21G. Sharp-eyed's classmates might have seen the last item. Display 24G, which indicates that all files in the current directory consume disk space and the total capacity is 24G.

After a couple of judgements, locate the Tomcat log file.

It can be judged that the 17G file is in the current directory (Tomcat log directory) file.

Third, how to locate the largest file

Input command: LS–LHS to show files in order from large to small

The final location file is: catalina.out this log file.

Iv. confirm that the file is not occupied

Delete Files who will: Rm–f catalina.out However, it is a good idea to confirm that you want to download it and let the developer analyze the log.

Hard to find the file, deleted very happy, input command: DF–LH found disk space is still full state. There is no difference from figure one. Is it necessary to restart the system? Is Linux going to be so unfriendly?

Google for a moment, found such a phrase:

In Linux or Unix systems, deleting files via RM or File Manager will unlink the file system from the directory structure (unlink). However, if the file is open (a process is in use), the process will still be able to read the file and disk space is always occupied.

Input command:/usr/sbin/lsof|grep deleted confirm that the deleted file is occupied

is actually occupied. According to the PID provided in the second column, enter the command: Kill-9 13117 kills the process.

Re-enter the command: DF–LH

, the disk space is freed. The problem has been dealt with successfully.

Linux hard disk is full of how to handle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.