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

Talk about the causes and handling methods of "too many links" error reports on Linux

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

Share

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

Description

Errors like "too many links" on Linux may be caused by a number of reasons. This section focuses on the two situations that led to this error:

* (1) ext3 file system. The error message is similar to the following:

Cannot create directory `/ home/ data` too many links

* (2) docker storage driver overlay. The error message is similar to the following:

Failed to register layer: link / data/sys/var/docker/overlay/xxxxx: too many links # # here using xxx to ignore the unimportant content is divided into two cases to analyze the ext3 file system

About the introduction of ext3, there are many excellent blogs or materials to refer to on the Internet. Here is a brief explanation:

(1) View the file system: df-lhT

(2) in the kernel code of Linux, the number of subdirectories at the first level of the include/linux/ext2_fs.h:#define EXT2_LINK_MAX 32000 and nclude/linux/ext3_fs.h:#define EXT3_LINK_MAX 32000 maiden ext3 file system defaults to 31998 (32000), to be exact.

(3) it is not recommended to have too many files or directories in one directory, which reduces the performance of the file system in finding files or directories.

(4) there is no special limit on the maximum number of files in a single directory under the ext3 file system, which is limited by the number of inode of the file system. Refer to Ruan Shen to understand inode

(5) ext4 has no limit on the number of directories.

After understanding the above routines, we can report "too many links" errors at the file system level by:

(1) replace the ext3 file system with ext4. Pay attention to the security of ️data. For more information, please see: failed: Too many links solution

(2) clear useless directories or files

Docker storage-driven overlay

For this piece, please refer to my previous article on changing the Docker storage driver from overlay to overlay2. Two methods are given in the article:

To solve the "too many links" problem above, you can use the following two methods:

(1) temporary method: delete useless images and exited containers regularly, and use docker system prune.

(2) permanent method: upgrade the storage driver from overlay to overlay2.

Reference documentation

* (1) failed: Too many links solution

* (2) Docker storage driver has been changed from overlay to overlay2

* (3) Directory restriction of ext3 file system

* (4) understand inode

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