Chinaunix首页 | 论坛 | 博客
  • 博客访问: 316223
  • 博文数量: 50
  • 博客积分: 3052
  • 博客等级: 中校
  • 技术积分: 710
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-03 12:13
文章分类
文章存档

2009年(10)

2008年(40)

我的朋友

分类: LINUX

2008-06-03 22:16:47

在centos5.1上应用xfs文件系统

1、安装环境:
浪潮服务器,centos5.1

2、安装相应的软件包
xfs在默认的系统安装上是不被支持的,需要自己手动安装默认的包。
先修过yum的配置文件
# vim /etc/yum.repos.d/CentOS-Base.repo
[centosplus]
enabled=1                //把0改为1
# yum install xfsprogs kmod-xfs         //安装软件包

3、创建分区并格式化
# fdisk /dev/sdb                        //创建一个分区
Command (m for help): p
Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
1
Invalid partition number for type `1'
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19457, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457): +50000M
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# mkfs.xfs -f /dev/sdb1                //把sdb1格式化为xfs文件系统
# parted /dev/sdb                      //查看分区的文件系统
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                               
Model: ATA ST3160811AS (scsi)
Disk /dev/sdb: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number  Start   End     Size    Type     File system  Flags
1      32.3kB  5009MB  5009MB  primary  xfs              

4、挂载分区
# modprobe xfs               //载入xfs文件系统模块,如果不行要重启服务器
# lsmod |grep xfs            //查看是否载入了xfs模块
# mkdir /hehe
# mount -t xfs /dev/sdb1 /hehe           //把分区挂载到目录上

5、比较ext3和xfs对大文件的写性能
ext3文件系统19G的文件大小
# time dd if=/dev/zero of=/opt/aaaa bs=1024 count=19922944   
19922944+0 records in
19922944+0 records out
20401094656 bytes (20 GB) copied, 427.068 seconds, 47.8 MB/s
real    7m7.569s
user    0m11.736s
sys     2m5.521s

xfs文件系统19G的文件大小
# time dd if=/dev/zero of=/hehe/aaaa bs=1024 count=19922944   
19922944+0 records in
19922944+0 records out
20401094656 bytes (20 GB) copied, 701.545 seconds, 29.1 MB/s
real    11m41.603s
user    0m11.324s
sys     1m20.507s

奇怪,我测试的ext3比xfs好,想了一下应该是这个问题:
/dev/和/opt/都在sda硬盘,它们之间的读写文件属于硬盘内部数据传输,而第二次属于硬盘间的数据传输,肯定要慢。

在/sdb硬盘上再建立一个40G大小的ext3的分区,并挂载到/xixi上,再测试
# time dd if=/dev/zero of=/xixi/aaaa bs=1024 count=19922944        
19922944+0 records in
19922944+0 records out
20401094656 bytes (20 GB) copied, 655.906 seconds, 31.1 MB/s
real    10m55.955s
user    0m11.687s
sys     2m9.008s

还是ext3快一些,那我就不明白了,为什么说xfs对大文件的读写性能要比ext3好呢!?
后来又做了一些测试发现是xfs的性能好,前面的测试我估计是因为/dev/zero 是在ext3的文件系统里,两个同样的文件系统之间复制文件应该快点!
阅读(1264) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~