Linux and Windows file name length restrictions

Source: Internet
Author: User

Linux File Names can contain up to 255 characters

 

In Windows, the fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

 

Linux restrictions on the number of parts, directories, and file name length

The following test results are obtained without kernel optimization or modification.

1. Purpose: To test the maximum filename length in the ext3 File System
Test Platform: rhel5u3_x64
Test process:
Lenth = 'For I in {1 .. 255}; do for X in a; do echo-N $ X; done; done'
Touch $ lenth
When it reaches 256, touch reports an error, File Name Too Long
In Linux, The ext3 File System names the files/directories. The maximum length is 127 Chinese characters. In English, the maximum length is 255 characters.

2. purpose: to limit the number of sub-directories under the ext3 File System
Test Platform: rhel5u3_x64
Test process:
[Root @ fileserver maxdir] # For I in {1 .. 32000}; do mkdir $ I; done
Mkdir: cannot create directory '20170101': Too using links
Mkdir: cannot create directory '20170101': Too using links
The number of first-level subdirectories of the ext3 file system is 31998 ).
Linux defines the CPU search efficiency. To change the number, recompile the kernel.

3. Purpose: To test the maximum number of files in a directory placed by the ext3 File System
Test Platform: rhel5u3_x64
Test process:
There seems to be no special limit on the maximum number of files in a single directory, which is also limited by the number of inode in the file system:
DF-I or use tune2fs-L/dev/sdax or dumpe2fs-H/dev/sdax to view the number of inode available. The last two Commands
The output results are the same, but there are some errors with the number of available inode obtained by DF. So far, I do not understand why.

There are two common solutions on the Internet:
1) re-mkfs. The default block size of ext3 is 4096 bytes. The block size is smaller than that of inode.
2) temporary solution using the loopback File System:
Create a large file in/usr (or elsewhere), create a loopback file system, and move the original file to this
File System, and mount it to the appropriate location in/usr. This can greatly reduce the number of files in your/usr. But the system
Performance may be compromised.

4. Purpose: To test the maximum number of opened files (file handle and file descriptor)
Test Platform: rhel5u3_x64
Set ulimit-N 65535, or set the number of files opened, processes, and CPU in/etc/security/limit. conf.

 

 Original article addressHttp://dx.ylmf.net/read.php? Tid = 1330799

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.