Solve the Linux system under the partition file occupies a total space than the actual partition total capacity is small but prompted disk space is full of problems __linux

Source: Internet
Author: User
Tags disk usage

I have a strange problem today, colleague Response deployment Tomcat partition/app Unable to upload files, whether with Lrzsz or Xshell attached xftp can not upload files to the specified location, after checking directory permissions are allowed to write, and then view the system partition space size found that the space is full, the following figure ( Please ignore the following garbled)

As shown in the/app directory on the diagram on the logical volume/dev/mapper/vs_app-lv_app the 94% occupancy rate (the original occupancy rate is 100% full, after manually deleting some files down to 94%), but the total amount of real size used to view the app directory is less than 40G. So I feel very strange, total space 145G there are more than 100 g where to go. The directory also has no hard links, so start to suspect the server hard disk, array failure, and so on, but first start checking the LVM logical volume configuration:

Filtering out memory RAM, it can be seen that three system physical volumes/dev/sda3,/dev/sda4,/dev/sda5 act as physical volumes in LVM, with a total size of around 4TB, while/dev/vg_app/lv_ The total size of the app is 146.48GB, which is one of the logical volumes that the LVM splits up, and with Fdisk, the rest of the physical volumes Sda1,sda2,sda6 are in normal condition. So Baidu, find an article, the contents are as follows:

After the files in Linux are deleted, the space is not released because in Linux, deleting files via RM or File Manager will unlink the file system from the directory structure (unlink). However if the file is open (there is a process in use), Then the process will still be able to read the file, and disk space has been occupied.
Workaround:
1, first DF-LH check the disk usage status
2, find the deleted files in the partition, eg.opt partition
3. View all files that have been deleted: Lsof-n/opt |grep deleted
The results are as follows: [Root@test app]# lsof-n/opt |grep Delete
Sftp-serv 8195 root 5r REG 104,6 8214888448 786452/opt/software/resin-pro-3.1.10/log/jvm-app-a.log (Deleted)
4, Kill 8195
5, then run lsof-n/opt |grep Delete, should not have the results above.
6, then run DF-LH to see if the space has been released.

--------------------------------------------------The original text dividing line---------------------------------------------------------

as described in the above, the/app that is deployed under directory/tomcat/logs/generates logs each time the runtime is run Catalina.out, when the partition capacity is full and cannot continue to write, will cause Tomcat to run abnormally, so you need to periodically clean up log files (delete, compress backup transfer, log scrolling), combined with the information provided by colleagues, know that the log files for the direct delete operation. So using the above command lsof-n/app | The partition space size returns to normal after the grep delete checks the space for files that have not been freed and kills the process PID. Upon enquiry, the problem is due to the fact that a colleague did not deactivate the Tomcat service while performing a log cleanup operation on Tomcat, so it is generally not necessary to operate the related files during application run.

Related Article

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.