Optimize the XFS File System In Debian

Source: Internet
Author: User
Tags what file system
Optimize the XFS File System In Debian-the Linux Release Technology-Debian information. See the following for details. First, let's briefly explain why xfs file system is selected. In the Debian GNU/Linux system, we can use reiserfs, xfs, jfs and other file systems to replace ext3 in the current situation. They all have some good features.

In my thinking, when selecting a file system, we should first consider the hardware conditions, focusing on the cpu capacity (single-core or multi-core, cache size), memory and hard disk capacity, and so on. What file system does your system use? You still need to perform some tests and comparisons on your own. In terms of software, the performance of the file system is closely related to the parameters used when it is created and the parameter selection during mounting. Most users, only use the default parameters of the installer to create and mount a file system.

Therefore, please pay attention to the software and hardware conditions in this article.

Hardware conditions for my notebook:
CPU: T2450 L1 instruction buffer/data buffer are 32KB, 8-way; Unified L2 is 2 MB, segmented, 8-way
Memory: 512 + 1 GB
Hard Disk: 120 GB

Software conditions:
Debian 4.0r1
Linux Kernel: 2.6.22 (in the Debian source)
Xfsprogs: I used CD1 of 4.0r1 to install debian. In this case, the testing version is 2.9.0-1.

Compare the file system method. You can find it from the above link or use bonnie ++. I am not focusing on it here, So I skipped it. In short, in the end, I chose to use the xfs file system most, supplemented by ext3.

For more information about how to improve the performance of the xfs file system, see Filesystem performance tweaking with XFS on Linux. Here I will describe the reason and the actions to be taken when Debian is installed.

According to the instructions in section 2 above, we must carefully read mkfs. xfs and mount manpages about xfs.

The first is mkfs. xfs, which focuses on the following:

-I size = 512: The default value is KB. The setting here is for selinux. This setting is for inode size. selinux uses the Extend Attribute of xfs and must first be written to inode, if the capacity is not enough (the default value is kb, just a little more), it will be written into the block, which will result in performance loss when selinux is needed. This seems to have no effect on general users, because general users do not need selinux, and everyone trusts the security of the linux system. But to be honest, I don't trust it, besides, the RedHat FC has configured selinux by default, which is good. After this change, I will configure selinux in the system without worrying about performance loss.

-L size = 128 m: note that the values are in lower case, not in upper case. The default value is 10 m (bsize = 4096 x blocks = 2560 ). This value can be set to 32 m (partition capacity not less than 250 M), 64 m (partition capacity not less than 500 M), 128 m (partition capacity not less than 700 M ), for the partition capacity limit, I listed here only about, the maximum can be set to 128 m. Modifying this parameter to 128 MB can significantly improve the speed at which the xfs File System deletes files. Of course, there are other such parameters as the speed at which files are copied. This parameter requires support from a large amount of memory. Machines with too few memory may not be set to this high. (What is the standard? 512 M? 1G? I don't know, so I want to test it myself .)

-D agcount = 4: The default value is automatically set based on the capacity. You can set it to 1/2/4/16. This parameter can be used to adjust the CPU usage. The smaller the value, the lower the consumption rate. In theory, agcount = 1 is higher than the cpu usage of agcount = 2 on my machine. I think this is because my cpu is dual-core. Note that the cpu usage is low, and the amount of data processed per second will also decrease. I compared agcount = 2 and 4 and found that 4 is better. In this way, you must select this parameter.

Second, the mount option during mount:
Noatime: This mount option is used by many file systems.
Logbufs = 8: This option requires the support of large memory, which can also improve the overall xfs performance.

OK. The next step is how to install Debian.

I used debian 4.0r1 CD1 moment CD to install it, and all the way into the partition program part, pay attention to two points:

1. After selecting the file system format of the partition as xfs, and selecting the Mount parameter noatime, modify the fstab in the future.

2. After setting, there is no real hard disk formatting. If you go to the next step to "partition setting is complete and write modifications to the hard disk", the installer will automatically format and mount the disk, the next step is to set the time zone, which causes a lot of trouble. Fortunately, I used lvm. In this way, I added a "Configure logical volume manager" on the "disk partition" interface. When I enter it, I will first prompt you to format the partition you just set, then, allocate the logical volume and exit the "disk partition" interface.

Use Alt + F2 to switch out of the installer console, A busybox that provides mkfs. xfs command, so that we can re-use the new parameter to create the xfs partition. The command example is as follows:

Mkfs. xfs-f-I size = 512-l size = 128 m-d agcount = 4/dev/debian/root

Here,/dev/debian/root, debian is the name of the created logical volume group, and root is the name of the logical volume, which is obviously mounted. For the use of logical volume lvm, I also write instructions.

In this way, when Alt + F1 switches back to the installation interface, you can immediately "partition settings are complete and the modifications are written to the hard disk", and the installer will no longer format the partition, instead, it loads the partition that we re-formatted.

Then complete the installation. Busybox does not provide xfsprogs (we need xfs_info), so we can only check it after installing the basic system.

From the output of xfs_info, we can clearly see that isize = 512, agcount = 4, and bsize = 4096 x blocks = 32768/2 ^ 20 is exactly 128.

The above is a piece of content in/etc/fstab.

SO, here, we have done everything. Good Luck! And Enjoy it.

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.