|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的小伙伴们!XFS是扩大性高、高功能的文件体系。也是rhel7/centos7的默许文件体系。
XFS撑持metadatajournaling,这使其能从crash中更疾速的规复。
它也撑持在挂载和举动的形态下举行碎片收拾和扩容。
经由过程提早分派,XFS博得了很多时机来优化写功能。
可经由过程工具xfsdump和xfsrestore来备份和规复xfs文件体系,
xfsdump可以使用dump级别来完成增量备份,还可经由过程size,subtree,inodeflags来扫除文件。
也撑持user、group、project配额。
上面将先容怎样创立xfs文件体系,分派配额和对其扩容:
###############################################################################
将/dev/sdb分区(2G),并启动LVM功效
[root@localhostzhongq]#parted/dev/sdb
GNUParted3.1
Using/dev/sdb
WelcometoGNUParted!Typehelptoviewalistofcommands.
(parted)mkpartprimary42048
(parted)set1lvmon
(parted)p
Model:VMware,VMwareVirtualS(scsi)
Disk/dev/sdb:2147MB
Sectorsize(logical/physical):512B/512B
PartitionTable:gpt
DiskFlags:
NumberStartEndSizeFilesystemNameFlags
14194kB2048MB2044MBprimarylvm
###############################################################################
创立PV
[root@localhostzhongq]#pvcreate/dev/sdb1
Physicalvolume"/dev/sdb1"successfullycreated
[root@localhostzhongq]#pvdisplay
---Physicalvolume---
PVName/dev/sda2
VGNamecentos
PVSize24.51GiB/notusable3.00MiB
Allocatableyes(butfull)
PESize4.00MiB
TotalPE6274
FreePE0
AllocatedPE6274
PVUUID9hp8U7-IJM6-bwbP-G9Vn-IVuJ-yvE8-AkFjcB
"/dev/sdb1"isanewphysicalvolumeof"1.90GiB"
---NEWPhysicalvolume---
PVName/dev/sdb1
VGName
PVSize1.90GiB
AllocatableNO
PESize0
TotalPE0
FreePE0
AllocatedPE0
PVUUIDbu7yIH-1440-BPy1-APG2-FpvX-ejLS-2MIlA8
###############################################################################
将/dev/sdb1分派到名为xfsgroup00的VG
[root@localhostzhongq]#vgcreatexfsgroup00/dev/sdb1
Volumegroup"xfsgroup00"successfullycreated
[root@localhostzhongq]#vgdisplay
---Volumegroup---
VGNamecentos
SystemID
Formatlvm2
MetadataAreas1
MetadataSequenceNo3
VGAccessread/write
VGStatusresizable
MAXLV0
CurLV2
OpenLV2
MaxPV0
CurPV1
ActPV1
VGSize24.51GiB
PESize4.00MiB
TotalPE6274
AllocPE/Size6274/24.51GiB
FreePE/Size0/0
VGUUIDT3Ryyg-R0rn-2i5r-7L5o-AZKG-yFkh-CDzhKm
---Volumegroup---
VGNamexfsgroup00
SystemID
Formatlvm2
MetadataAreas1
MetadataSequenceNo1
VGAccessread/write
VGStatusresizable
MAXLV0
CurLV0
OpenLV0
MaxPV0
CurPV1
ActPV1
VGSize1.90GiB
PESize4.00MiB
TotalPE487
AllocPE/Size0/0
FreePE/Size487/1.90GiB
VGUUIDejuwcc-sVES-MWWB-3Mup-n1wB-Kd0g-u7jm0H
###############################################################################
利用下令lvcreate来创立xfsgroup00组巨细为1G的名为xfsdata的LV
[root@localhostzhongq]#lvcreate-L1024M-nxfsdataxfsgroup00
WARNING:xfssignaturedetectedon/dev/xfsgroup00/xfsdataatoffset0.Wipeit?[y/n]y
Wipingxfssignatureon/dev/xfsgroup00/xfsdata.
Logicalvolume"xfsdata"created
[root@localhostzhongq]#lvdisplay
---Logicalvolume---
LVPath/dev/centos/swap
LVNameswap
VGNamecentos
LVUUIDEnW3at-KlFG-XGaQ-DOoH-cGPP-8pSf-teSVbh
LVWriteAccessread/write
LVCreationhost,timelocalhost,2014-08-1820:15:25+0800
LVStatusavailable
#open2
LVSize2.03GiB
CurrentLE520
Segments1
Allocationinherit
Readaheadsectorsauto
-currentlysetto8192
Blockdevice253:0
---Logicalvolume---
LVPath/dev/centos/root
LVNameroot
VGNamecentos
LVUUIDzmZGkv-Ln4W-B8AY-oDnD-BEk2-6VWL-L0cZOv
LVWriteAccessread/write
LVCreationhost,timelocalhost,2014-08-1820:15:26+0800
LVStatusavailable
#open1
LVSize22.48GiB
CurrentLE5754
Segments1
Allocationinherit
Readaheadsectorsauto
-currentlysetto8192
Blockdevice253:1
---Logicalvolume---
LVPath/dev/xfsgroup00/xfsdata
LVNamexfsdata
VGNamexfsgroup00
LVUUIDO4yvoY-XGcD-0zPm-eilR-3JJP-updU-rRCSlJ
LVWriteAccessread/write
LVCreationhost,timelocalhost.localdomain,2014-09-2315:50:19+0800
LVStatusavailable
#open0
LVSize1.00GiB
CurrentLE256
Segments1
Allocationinherit
Readaheadsectorsauto
-currentlysetto8192
Blockdevice253:3
###############################################################################
格局化分区为xfs文件体系。
注重:xfs被创立后,其size将没法减少,但能够经由过程xfs_growfs来增年夜
[root@localhostzhongq]#mkfs.xfs/dev/xfsgroup00/xfsdata
meta-data=/dev/xfsgroup00/xfsdataisize=256agcount=4,agsize=65536blks
=sectsz=512attr=2,projid32bit=1
=crc=0
data=bsize=4096blocks=262144,imaxpct=25
=sunit=0swidth=0blks
naming=version2bsize=4096ascii-ci=0ftype=0
log=internallogbsize=4096blocks=2560,version=2
=sectsz=512sunit=0blks,lazy-count=1
realtime=noneextsz=4096blocks=0,rtextents=0
###############################################################################
挂载xfs体系分区到指定目次,并经由过程参数uquota,gquota开启文件体系配额。
?
1
2
3
4
5
[root@localhostzhongq]#mkdir/xfsdata
[root@localhostzhongq]#mount-ouquota,gquota/dev/xfsgroup00/xfsdata/xfsdata
[root@localhostzhongq]#chmod777/xfsdata
[root@localhostzhongq]#mount|grepxfsdata
/dev/mapper/xfsgroup00-xfsdataon/xfsdatatypexfs(rw,relatime,attr2,inode64,usrquota,grpquota)
###############################################################################
利用xfs_quota下令来检察配额信息和为用户和目次分派配额,并考证配额限定是不是失效。
[root@localhostzhongq]#xfs_quota-x-creport/xfsdata
Userquotaon/xfsdata(/dev/mapper/xfsgroup00-xfsdata)
Blocks
UserIDUsedSoftHardWarn/Grace
------------------------------------------------------------
root00000[--------]
Groupquotaon/xfsdata(/dev/mapper/xfsgroup00-xfsdata)
Blocks
GroupIDUsedSoftHardWarn/Grace
------------------------------------------------------------
root00000[--------]
[root@localhostzhongq]#xfs_quota-x-climitbsoft=100Mbhard=120Mzhongq/xfsdata
[root@localhostzhongq]#xfs_quota-x-creport/xfsdata
Userquotaon/xfsdata(/dev/mapper/xfsgroup00-xfsdata)
Blocks
UserIDUsedSoftHardWarn/Grace
------------------------------------------------------------
root00000[--------]
zhongq010240012288000[--------]
Groupquotaon/xfsdata(/dev/mapper/xfsgroup00-xfsdata)
Blocks
GroupIDUsedSoftHardWarn/Grace
------------------------------------------------------------
root00000[--------]
[root@localhostzhongq]#suzhongq
[zhongq@localhost~]$ddif=/dev/zeroof=/xfsdata/zq00bs=1Mcount=100
100+0recordsin
100+0recordsout
104857600bytes(105MB)copied,28.9833s,3.6MB/s
[zhongq@localhost~]$ddif=/dev/zeroof=/xfsdata/zq01bs=1Mcount=100
dd:errorwriting‘/xfsdata/zq01’:Diskquotaexceeded
21+0recordsin
20+0recordsout
20971520bytes(21MB)copied,4.18921s,5.0MB/s
[zhongq@localhost~]$exit
[root@localhostzhongq]#xfs_quota
xfs_quota>help
df[-bir][-hn][-ffile]--showfreeandusedcountsforblocksandinodes
help[command]--helpforoneorallcommands
print--listknownmountpointsandprojects
quit--exittheprogram
quota[-bir][-gpu][-hnNv][-ffile][id|name]...--showusageandlimits
Usehelpcommandnameforextendedhelp.
xfs_quota>print
FilesystemPathname
//dev/mapper/centos-root
/boot/dev/sda1
/var/lib/docker/dev/mapper/centos-root
/xfsdata/dev/mapper/xfsgroup00-xfsdata(uquota,gquota)
xfs_quota>quota-uzhongq
DiskquotasforUserzhongq(1000)
FilesystemBlocksQuotaLimitWarn/TimeMountedon
/dev/mapper/xfsgroup00-xfsdata12288010240012288000[6days]/xfsdata
###############################################################################
先利用下令lvextend将LV扩大为1.5G(初始容量是1G),然后利用下令xfs_growfs来对xfs文件体系扩容(这里以block计数)
[root@localhostzhongq]#lvextend-L1.5G/dev/xfsgroup00/xfsdata
Extendinglogicalvolumexfsdatato1.50GiB
Logicalvolumexfsdatasuccessfullyresized
[root@localhostzhongq]#xfs_growfs/dev/xfsgroup00/xfsdata-D393216
meta-data=/dev/mapper/xfsgroup00-xfsdataisize=256agcount=4,agsize=65536blks
=sectsz=512attr=2,projid32bit=1
=crc=0
data=bsize=4096blocks=262144,imaxpct=25
=sunit=0swidth=0blks
naming=version2bsize=4096ascii-ci=0ftype=0
log=internalbsize=4096blocks=2560,version=2
=sectsz=512sunit=0blks,lazy-count=1
realtime=noneextsz=4096blocks=0,rtextents=0
datablockschangedfrom262144to393216
[root@localhostzhongq]#df-h|grepxfsdata
/dev/mapper/xfsgroup00-xfsdata1.5G153M1.4G10%/xfsdata
欢迎大家来到仓酷云论坛! |
|