Change linux File block size

Source: Internet
Author: User
Change the linux File block size-Linux Enterprise Application-Linux server application information. For more information, see the following section. You can specify the block size when creating a file system. In the future, if some large files are used in your file system, using a large block size will provide better performance. Adjust the block size of the ext2 File System to 4096byte instead of the default 1024 byte, which can reduce file fragmentation and speed up fsck scanning and file deletion and read operations. In addition, the ext2 file system retains 5% of the space for the root directory. For a large file system, unless used as a log file, the proportion of 5% is too large. You can use the command "# mke2fs-B 4096-m 1/dev/hda6" to change it to 1% and create a file system with a block size of 4096byte.

The size of the chunks to be used depends on the overall consideration of your system. If the system is used as a mail or news server, a large chunk size is used, although the performance is improved, however, this will cause a large waste of disk space. For example, the average file size in the file system is 2145 bytes. If the block size of 4096byte is used, every file will waste bytes of space on average. If the block size of 1024 bytes is used, each file will waste bytes of space on average. How to balance the cost of performance and disk depends on the needs of specific applications.

1st group commands:
Mkfs. ext3-T news/dev/sda5 (specify the block size of the file system in this partition as 4096)
Mkfs. ext3-B 4096/dev/sda5

2nd group commands:
Mkfs. ext3-I 4096/dev/sda5 (specify 4096 bytes for each inode)
Mkfs. ext3/dev/sda5
Mkfs. ext3-B 2046-m 2/dev/hda5 format and set the data block to 2 kb and the reserved block to 2%

You can also set it using the tune2fs-m 2/dev/hda4 method without formatting.

Tune2fs-l/dev/hda5 allows you to view detailed information about the file system.

Tune2fs-j/dev/hda4 can convert ext2 to ext3 without damaging data

File System Check Tool: fsck e2fsck

E2fsck is dangerous, and file systems cannot be well identified, especially when both ext2 and ext3 are used.

Fsck usage: fsck-t ext3/dev/hda5 or fsck. ext3/dev/hda5

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.