Unreasonable "soft" method for solving Linux disk space partitioning

  

Due to the unreasonable design when installing the system, some partitions are too small, and network communication failures cause log files to grow rapidly, etc. Other reasons may be expressed as disk space. Full, causing the disk to be unreadable, the application cannot be executed, etc. Here are a few tricks for you (using /homespace as an example):


1, regularly scan important file systems, and compare and analyze those files frequently read and write

#ls –lR /home ;files.txt

#diff filesold.txt files.txt

Predicting the growth of space by analysis, while considering not reading and writing frequently Files are compressed to reduce the footprint.

2, view the memory system full of inodes consumption

#df – i /home

If there are a large number of inodes available, indicating that large files take up space, otherwise It is possible that a large number of small files take up space.


3, find out the directory with large space

View the space occupied by /home

#du –hs /home


View the space occupied by /home under 1000m

#du | Awk '$1;2000'

4. Find out the files that take up a lot of space

#find /home –size +2000k


5. Find out which files have been recently modified or created.

Touch a file with the time you want as follows:

# touch -t 08190800 test

#find /home -newer Test -print


6. Delete system logs, etc.

Delete files such as core, mbox, etc.

#find /-name core| Xargs rm –rf

Delete log

#rm -rf /var/log/*

7, link to partition

in space Partition, link to no space partition

#ln -s /home /usr/home

8, find out the process that consumes a lot of space


Find the corresponding process according to different applications. Analyze the reasons.

9, check and repair the file system

#fsck –y /home


10, restart the machine

has The above ten tricks should solve most of the problems, but the key is to plan the partition when installing. In addition, when the disk is full, you can't worry, be careful, carefully analyze the cause, and then carefully deal with it. 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 it still doesn't work, only take the "hard" approach of adding hard drives and reinstalling the system.

Copyright © Windows knowledge All Rights Reserved