redhat 5.5 上使用xfs 文件系统

发布时间:2020-09-09编辑:脚本学堂
要在redhat 5.5 上使用xfs 文件系统,必须借助centos 5.5 对于版本的一些软件包。

要在redhat 5.5 上使用xfs 文件系统,必须借助centos 5.5 对于版本的一些软件包。比如kmod-xfs,这个软件包是用来添加xfs.ko这个模块,使 5.5内核支持xfs 文件系统。我的内核是自己编译的,所以xfs已经编译在内核中,不需要kmod-xfs 这个软件包。

废话不说了,详细步骤如下,下载需要软件包:
 

复制代码 代码如下:

编译:
 

复制代码 代码如下:
 rpmbuild -ba /usr/src/redhat/SPECS/xfsprogs.spec
 rpmbuild -ba /usr/src/redhat/SPECS/xfsdump.spec
 rpmbuild -ba /usr/src/redhat/SPECS/dmapi.spec
 

    
安装:
 

复制代码 代码如下:
 rpm -ivh /usr/src/redhat/RPMS/x86_64/xfsprogs-2.9.4-1.x86_64.rpm
 rpm -ivh  /usr/src/redhat/RPMS/x86_64/xfsprogs-devel-2.9.4-1.x86_64.rpm
 rpm -ivh  /usr/src/redhat/RPMS/x86_64/dmapi-2.2.8-1.x86_64.rpm
 rpm -ivh /usr/src/redhat/RPMS/x86_64/dmapi-devel-2.2.8-1.x86_64.rpm
 rpm -ivh /usr/src/redhat/RPMS/x86_64/xfsdump-2.2.46-1.x86_64.rpm

就会有 mkfs.xfs fsck.xfs xfsdump xfsrestore 这两个命令

然后格式化硬盘:
mkfs.xfs -f -d agcount=4 -l size=128m -i size=512  /dev/vg_root/lv_www

-i 默认值为 256
-l 的默认值为 10m
agcount 默认自动分配

-l lazy-count=value
    This changes the method of logging various persistent counters  in  the  superblock.   Under metadata  intensive  workloads, these counters are updated and logged frequently enough that the superblock updates become a serialisation point in the  filesystem.  The  value  can  be either 0 or 1.
        With  lazy-count=1,  the superblock is not modified or logged on every change of the persis-tent counters. Instead, enough information is kept in other parts of the  filesystem  to  be able  to  maintain  the  persistent  counter  values  without  needed  to  keep  them in the superblock.  This gives significant improvements in performance on some configurations.  The default  value  is  0 (off) so you must specify lazy-count=1 if you want to make use of this feature.

修改/etc/fstab
 

复制代码 代码如下:
/dev/vg_root/lv_www  /www xfs defaults,nobarrier,logbufs=8,logbsize=32k  1 2

nobarrier
   Many hardware RAID have a persistent write cache which preserves it across power failure, interface resets, system crashes, etc. Using write barriers in this instance is not recommended and will in fact lower performance. Therefore, it is recommended to turn off the barrier support and mount the filesystem with "nobarrier". But take care about the hard disk write cache, which should be off.
logbufs=value
    Set  the number of in-memory log buffers.  Valid numbers range from 2-8 inclusive.  The default value is 8 buffers for filesystems with a blocksize of 64K, 4 buffers for filesystems with a blocksize of 32K,  3 buffers for filesystems with a blocksize of 16K, and 2 buffers for all other configurations.  Increasing the number of buffers may increase performance on some workloads at the cost of the memory used for  the additional log buffers and their associated control structures.

logbsize=value
   Set  the  size  of each in-memory log buffer.  Valid sizes are 16384 (16K) and 32768 (32K).  The default value for machines with more than 32MB of memory is 32768,  machines  with  less  memory  use  16384  by default.

参考文档:
  http://www.ibm.com/developerworks/cn/linux/filesystem/l-fs10/index.html
  http://saplingidea.javaeye.com/blog/636770