Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Handling failures with insufficient disk space and adding swap to the system (continue to share practical experience)

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. The study of du command

Du usage. Disk block is full. Use this command to find out which files or directories take up a large amount of space.

The difference between big and small: du du-Hmuri-human readable way du-sh displays the directory's

2. The collocation of du and sort.

-h cannot be used with n, it will report an error.

To display files or directories from large to small in reverse order.

3. Inode is full of simulations and solutions-- cases

First milestone: create a 100k file:

Dd if=/dev/zero of=/tmp/100k bs=1k count=100

The second Calendar tablet: formatting

Third milestone-Mount to the / app/log directory (does not exist by default)

Issue df-h after mounting

Check the number of inode when you are finished.

Check the inode number

Milestone 4: analog inode is now full

4. Delete a large number of small files below linux: (to solve the problem that the inode number is full, resulting in insufficient disk space) the command does not support too many file names.

Use find with rm to solve the problem of deleting a large number of files (the scope of deleting files with ls and rm is limited)

5. The principle of deleting linux files:

6. The simulation file is not deleted completely, resulting in insufficient disk space: (restart the service)

As long as there is deleted, the number of hard links is 0, the number of process calls is not 0, it is not deleted clean, someone is using it. Solution: restart the corresponding service (service name (software name) is rsyslog.service process name rsyslogd)

Lsof | grep delete-if you do not know the file name, use this command to find the corresponding process

Delete files before and after restarting the service:

7. Important summary of production environment:

1 "- causes a failure of 1-scheduled tasks-not directed to the black hole

2 "- block normally indicates that it is not occupied by a service or process

8. Case: out of memory, call swap (CVM does not have swap by default)

How to add swap:

Mkswap formatted swapon--- temporary mount swapoff uninstall

Swapon-s view the composition of swap

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report