1、修改yum配置文件,找到centosplus将enabled=0改为1
#vim /etc/yum.repos.d/CentOS-Base.repo
[centosplus]
enabled=1
2、添加xfs需要的用户组
#useradd mockbuild
3、安装xfs相关包,挂载xfs内核
# yum install xfsprogs kmod-xfs xfsdump xfsprogs-devel
# modprobe xfs
# lsmod |grep xfs
xfs 1042331 0
exportfs 4236 1 xfs
4、看看mkfs.xfs的参数选项
# mkfs.xfs --help
mkfs.xfs: invalid option -- '-'
unknown option --
Usage: mkfs.xfs
/* blocksize */ [-b log=n|size=num]
/* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,
(sunit=value,swidth=value|su=num,sw=num),
sectlog=n|sectsize=num
/* inode size */ [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,
projid32bit=0|1]
/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n
sunit=value|su=num,sectlog=n|sectsize=num,
lazy-count=0|1]
/* label */ [-L label (maximum 12 characters)]
/* naming */ [-n log=n|size=num,version=2|ci]
/* prototype file */ [-p fname]
/* quiet */ [-q]
/* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]
/* sectorsize */ [-s log=n|size=num]
/* version */ [-V]
devicename
is required unless -d name=xxx is given.
is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
is xxx (512 byte blocks).
5、开始格式化
# mkfs.xfs -f -i size=512 -l size=128m,lazy-count=1 -d agcount=16 /dev/VolGroup01/LogVol00
agsize (548535936 blocks) too big, maximum is 268435455 blocks
提示agsize太大了,增大agcount到32试试
# mkfs.xfs -f -b size=16384 -i size=512 -l size=128m,lazy-count=1 -d agcount=32 /dev/VolGroup01/LogVol00
agsize (68566992 blocks) too big, maximum is 67108863 blocks
还是提示agsize太大,不过68566992 blocks已经不比maximum值大多少了,再增大agcount一倍试试
# mkfs.xfs -f -i size=512 -l size=128m,lazy-count=1 -d agcount=64 /dev/VolGroup01/LogVol00
meta-data=/dev/VolGroup01/LogVol00 isize=512 agcount=64, agsize=137133984 blks
= sectsz=512 attr=2, projid32bit=0
data = bsize=4096 blocks=8776574976, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal log bsize=4096 blocks=32768, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
以上显示已经格式化成功,块大小是默认大小4K;下面mount到/data下,挂载成功!
# mount -t xfs /dev/VolGroup01/LogVol00 /data