Post: optimize the XFS File System In Debian

Source: Internet
Author: User
Tags what file system

From:

Http://blog.csdn.net/leo_cao/archive/2007/11/03/1864996.aspx

 

 

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. For the latest comparative article, see filesystems (ext3, Reiser, XFS, JFS) Comparison on Debian etch. Note the references at the end for further reading.

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. However, 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. In addition, if xfs_growfs is used in the system, the value of this parameter is dynamically added.

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" page.

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!

 

 

Add a link to introduce XFS:

Http://hi.baidu.com/netnat/blog/item/0969cda27f8901accaefd039.html

 

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.