In Linux, the middleware log file is deleted. df shows that the disk space is still not released.

Source: Internet
Author: User
In Linux, when the middleware log file is deleted, df shows that the disk space is still not released. when the disk size exceeds the standard, an alarm is triggered. in this case, it is wise to master the df and du commands. Df allows you to view the size, usage ratio, file system, and Mount point of a level-1 folder.
In Linux, when the middleware log file is deleted, df shows that the disk space is still not released. when the disk size exceeds the standard, an alarm is triggered. in this case, it is wise to master the df and du commands. Df allows you to view the size, usage ratio, file system, and its Mount point of a level-1 folder, but there is nothing to do with files. Du allows you to view the file and folder size. They are very effective when used in combination. For example, you can use df to check which level directory is too large, and then use df to view the size of the folder or file, so that you can quickly determine the crux of the problem. The following is a brief introduction of the df command to show the available space and usage of all file systems: [yayug @ yayu ~] $ Df-h Filesystem Size Used Avail Use % Mounted on/dev/sda1 3.9G 300 M 3.4G 8% // dev/sda7 100G 188 M 95G 1%/data0/dev/ sdb1 133G 80G 47G 64%/data1/dev/sda6 7.8G 218 M 7.2G 3%/var/dev/sda5 7.8G 166 M 7.2G 3%/tmp/dev/sda3 9.7G 2.5G 6.8G 27%/usr tmpfs 2.0G 0 2.0G 0%/dev/shm www.2cto.com parameter-h indicates the use of "Human-readable" output, that is, the size of the file system is in the format of GB, MB, and other readable formats. The first field output (Filesystem) and the last field (Mounted on) are respectively the file system and its Mount point. We can see that the/dev/sda1 partition is mounted under the root directory. The following four fields: Size, Used, Avail, and Use % are the capacity, Used Size, remaining Size, and percentage of the Shard. In FreeBSD, when the hard disk capacity is full, you may see that the percentage used exceeds 100%, because FreeBSD will leave some space for the root user to make the root user full in the file system, you can also write something to the file system for management. Du: disk space used to query files or folders if there are many files and folders in the current directory, you can use the command without the parameter du to list the space used by all files and folders cyclically. This is not good for checking whether the location is too large. Therefore, you must specify the number of layers in the directory. the parameter is -- max-depth =, which is a very useful parameter! As shown in the following figure. use "*" to obtain the space used by the file. reminder: FreeBSD, which is always more complex than linux, uses the "du" command to specify the number of layers in the directory, which is simpler than that in linux. it is-d. The following code snippets are available at www.2cto.com: [root @ bsso yayu] # du-h -- max-depth = 1 work/testing 27 M work/testing/logs 35 M work/testing [root @ bsso yayu] # du- h -- max-depth = 1 work/testing/* 8.0 K work/testing/func. php 27 M work/testing/logs 8.1 M work/testing/nohup. out 8.0 K work/testing/testing_c.php 12 K work/testing/testing_func_reg.php 8.0 K work/testing/testing_get.php 8.0 K work/testing/testing_g.php 8.0 K work/testing/var. Php [root @ bsso yayu] # du-h -- max-depth = 1 work/testing/logs/27 M work/testing/logs/[root @ bsso yayu] # du- h -- max-depth = 1 work/testing/logs/* 24 K work/testing/logs/errdate. log_show.log 8.0 K work/testing/logs/pertime_show.log 27 M work/testing/logs/show. log is worth noting that I have seen an article about the similarities and differences between the du and df commands: solving false positives caused by the difference in du df. Www.2cto.com du statistical file size addition df statistical data block usage if a process opens a large file, this large file is directly deleted by rm or mv, then du will update the statistical value, df does not update the statistics, or thinks the space is not released. Until the process of opening a large file is killed. In this way, when files under/var/spool/clientmqueue are deleted regularly, if the process is not killed, the space is never released. Use the following command to kill the process and restore the system. Fuser-u/var/spool/clientmqueue www.2cto.com ======================== ========================================== other examples: count the total size du-sh xmldb/du-sm * | sort-n // count the current directory size and sort the values du-sk * | sort-n du-sk * | grep guojf // view the size of a person du-m | cut-d "/"-f 2 // view the text before the second character to view the number of files in this folder /*/* /* how many files are there: du xmldb/* | wc-l 40752 explanation: wc [-lmw] parameter description:-l: how many rows-m: How many characters-w: how many words
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.