一 XFS文件系統(tǒng)簡(jiǎn)介
XFS是高性能文件系統(tǒng)童芹,SGI為他們的IRIX平臺(tái)而設(shè)計(jì)。自從2001年移植到Linux內(nèi)核上鲤拿,由于它的高性能假褪,XFS成為了許多企業(yè)級(jí)系統(tǒng)的首選,特別是有大量數(shù)據(jù)近顷,需要結(jié)構(gòu)化伸縮性和穩(wěn)定性的生音。例如,RHEL/CentOS 7 和Oracle Linux將XFS作為默認(rèn)文件系統(tǒng)窒升,SUSE/openSUSE已經(jīng)為XFS做了長(zhǎng)期支持缀遍。
XFS有許多獨(dú)特的性能提升功能使他從眾多文件系統(tǒng)中脫穎而出,像可伸縮/并行 IO饱须,元數(shù)據(jù)日志域醇,熱碎片整理,IO 暫停/恢復(fù)蓉媳,延遲分配等譬挚。
二 安裝XFS系統(tǒng)工具集
Debian, Ubuntu , Linux Mint系統(tǒng):
$ sudo apt-get install xfsprogs
Fedora, CentOS, RHEL系統(tǒng):
$ sudo yum install xfsprogs
其他版本Linux:
$ sudo pacman -S xfsprogs
三創(chuàng)建分區(qū)
查看下是否有分區(qū)
<code><p>
root@HWPKI-TEST-98:~# fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00083283
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 968601599 484299776 83 Linux
/dev/sda2 968603646 976771071 4083713 5 Extended
/dev/sda5 968603648 976771071 4083712 82 Linux swap / Solaris
Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x3ab14c4d
Device Boot Start End Blocks Id System
</p></code>開(kāi)始分區(qū)
<code>
root@HWPKI-TEST-98:~# fdisk /dev/sdb
WARNING: The size of this disk is 3.0 TB (3000592982016 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT)
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Command (m for help):
</code>輸入m,查看命令:
<code>
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Command (m for help):
</code>
- 輸入n新建一個(gè)分區(qū)酪呻,輸入p 建立分區(qū)殴瘦,輸入分區(qū)編號(hào) 1
然后一路默認(rèn) - 輸入w保存
四 格式化分區(qū)
1.格式化分區(qū)為XFS,使用mkfs.xfs命令号杠。如果已有其他文件系統(tǒng)創(chuàng)建在此分區(qū)蚪腋,必須加上"-f"參數(shù)來(lái)覆蓋它。
sudo mkfs.xfs -f /dev/sdb1
2.格式化后分區(qū)來(lái)掛載姨蟋。假設(shè)/mnt是XFS本地掛載點(diǎn)屉凯。使用下述命令掛載
sudo mount -t xfs /dev/sdb1 /mnt
3.驗(yàn)證XFS掛載是否成功:
df -Th /storage
4.如果你想要啟動(dòng)時(shí)自動(dòng)掛載XFS分區(qū)在/storage上,加入下列行到/etc/fstab:
/dev/sdb1 /storage xfs defaults 0 0
參考文章:
Linux有問(wèn)必答-如何創(chuàng)建和掛載XFS文件系統(tǒng)
linux 硬盤(pán)分區(qū)眼溶,分區(qū)悠砚,刪除分區(qū),格式化堂飞,掛載灌旧,卸載筆記