xfs文件系統掛載大容量磁盤


公司新購了台存儲,24塊SATA盤,每塊2T,用22塊做了兩組RAID6,剩余兩塊為熱備;兩組RAID6的物理卷放進了一個邏輯卷,由此這個邏輯卷直達32T。
OS版本:centos 6.3
 # lvdisplay
  --- Logical volume ---
  LV Path                /dev/VolGroup01/LogVol00
  LV Name                LogVol00
  VG Name                VolGroup01
  LV UUID                Ts6MOq-etKx-GDPU-0AHF-jIMi-pqrz-cssj7v
  LV Write Access        read/write
  LV Creation host, time , 
  LV Status              available
  # open                 0
  LV Size                32.70 TiB
  Current LE             8570874
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2
以前從來沒格式化過這么大空間的卷,嘗試用ext4,做了好多遍都沒能成功;改用 xfs,終於搞定,在此記一筆。
  
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
<devicename> is required unless -d name=xxx is given.
<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),
      xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).
<value> 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
 
期間嘗試過將塊大小設大一點,比如16K,格式化可以完成,但掛載時總是報錯;
 # mkfs.xfs -f -b size=16384 -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=34283496 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=16384  blocks=2194143744, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=16384  ascii-ci=0
log      =internal log           bsize=16384  blocks=8192, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=16384  blocks=0, rtextents=0
 
 # mount -t xfs /dev/VolGroup01/LogVol00 /data
mount: Function not implemented
 # pagesize 
4096
 
在XFS官網文檔里貌似找到了答案:

mkfs - Allocation Block Size

Specify the fundamental allocation block size of the filesystem.
The default value is 4KB, the minimum is 512 bytes, and the maximum is 64KB
XFS on Linux currently only supports pagesize or smaller blocks.
To create a filesystem with a block size of 2048 bytes you would use:
mkfs.xfs -b size=2048 device
Smaller block sizes reduce wasted space for lots of small files.
就是說格式化的時候塊大小要小於等於操作系統pagesize
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM