linux下掛載新硬盤(pán),設(shè)置為XFS文件系統(tǒng)

一 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ū)

  1. 查看下是否有分區(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>

  2. 開(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>

  3. 輸入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>

  1. 輸入n新建一個(gè)分區(qū),輸入p 建立分區(qū),輸入分區(qū)編號(hào) 1
    然后一路默認(rèn)
  2. 輸入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ū),格式化,掛載,卸載筆記

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容