How to do disk space shortage, linux disk cleaning method

  
                  

Due to the unreasonable design of the original installation system, the small size of some partitions, and the network file failure, etc., the log file speed is increased, and other reasons can be expressed as the disk space is full, the disk cannot be read and written, and the application cannot be executed. Here are a few tricks for you (using /homespace as an example):

1. Regularly scan important file systems and compare them to analyze those files that are often read and written

#IS -IR/home>;files.txt

#diff filesold.txt files.txt

By analyzing the growth of the prediction space, you can also consider compressing files that are not frequently read and written. Reduce the footprint.

2. View the inodes consumption of the space file system

#df-i/home

If there are a large number of inpde available, it means that the large file takes up space, otherwise the thief may A large number of small files take up space.

3. Find the directory with a large space

View the space occupied by /home

#du-hs/home

View under /home Take up more than 1000m

#du/awk'$1>;2000'

4. Find out the files that take up more space

#find/home-size + 2000K

5. Find out the files that have been recently modified or created

First TOUCH a file of the time you want as follows

#TOUCH-t 08190800 test

#find/home-newer test-print

Deleting logs

#rm-rf/var/log/*

7.Connecting partitions

In a partition with space, do not connect to an empty partition

#in-s/home/use/home

8. Find a process that consumes a lot of space

Find the corresponding process and analyze the reason according to different applications.

9.Check and repair the file system

#fsck-y/home

10.Restart the machine

With the above ten tricks, you should be able to Solve most of the problems, but the key is to plan the partition when installing. In addition, I found that the disk is very time-consuming, can not be anxious, careful operation, carefully analyze the reasons, and then carefully deal with. Need to pay attention to the above ten strokes do not need to be executed sequentially, and some may take a step to seal the throat, and some may need several strokes to use, the removal operation must be careful. If you still can't, only take the hard drive, reinstall the system, etc. "hard" approach

You can also:

cd/

du-h--max- Depth=q/grep M/sort-n

Go to the directory after finding the largest directory

Run du-h-max-depth=1/grep M /sort-n< Br>

Find out which files are useful later.

Use it if you don't use it

Copyright © Windows knowledge All Rights Reserved