XFS檔案系統擴容

2021-10-20 01:56:57 字數 2963 閱讀 4861

xfs檔案系統擴容

注意:備份!備份!備份!操作前備份!

檢視磁碟掛載、分割槽資訊

root@bj-centos7 ~ # df -ht | grep vdc 

/dev/vdc1 xfs 10g 33m 10g 1% /vdc1

root@bj-centos7 ~ #

root@bj-centos7 ~ # lsblk /dev/vdc

name maj:min rm size ro type mountpoint

vdc 253:32 0 30g 0 disk

└─vdc1 253:33 0 10g 0 part /vdc1

進行分割槽擴容(等同分割槽重建,注意扇區起始位置不要錯誤)

root@bj-centos7 ~ # umount /dev/vdc1 

root@bj-centos7 ~ #

root@bj-centos7 ~ # fdisk /dev/vdc

歡迎使用 fdisk

(util-linux 2.23.2)。

更改將停留在記憶體中,直到您決定將更改寫入磁碟。

使用寫入命令前請三思。

命令(輸入 m 獲取幫助):p

磁碟 /dev/vdc:32.2 gb, 32212254720 位元組,62914560 個扇區

units = 扇區 of 1 * 512 = 512 bytes

扇區大小(邏輯/物理):512 位元組 / 512 位元組

i/o 大小(最小/最佳):512 位元組 / 512 位元組

磁碟標籤型別:dos

磁碟識別符號:0x2ebd63d4

裝置 boot start end blocks id system

/dev/vdc1 2048 20973567 10485760 83 linux

命令(輸入 m 獲取幫助):d

已選擇分割槽 1

分割槽 1 已刪除

命令(輸入 m 獲取幫助):n

partition type:

p primary (0 primary, 0 extended, 4 free)

e extended

select (default p): p

分割槽號 (1-4,預設 1):1

起始 扇區 (2048-62914559,預設為 2048):

將使用預設值 2048

last 扇區, +扇區 or +size

(2048-62914559,預設為 62914559):

將使用預設值 62914559

分割槽 1 已設定為 linux 型別,大小設為 30 gib

命令(輸入 m 獲取幫助):w

the partition table has been altered!

calling ioctl(

) to re-read partition table.

warning: re-reading the partition table failed with error 16: 裝置或資源忙.

the kernel still uses the old table. the new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

正在同步磁碟。

root@bj-centos7 ~ #

root@bj-centos7 ~ # partprobe

3. 檔案系統擴容(注意分割槽擴容完成後需要執行 partprobe 命令)

partprobe 命令用於重讀分割槽表,告訴核心分割槽表有變更,不然使用 xfs_growfs 命令擴容檔案系統時可能會出現擴容無效情況

xfs_growfs 命令執行需要分割槽是掛載狀態,不然會報錯

root@bj-centos7 ~ # xfs_growfs /dev/vdc1  

xfs_growfs: /dev/vdc1 is not a mounted xfs filesystem

root@bj-centos7 ~ #

root@bj-centos7 ~ # mount /dev/vdc1 /vdc1

root@bj-centos7 ~ #

root@bj-centos7 ~ # xfs_growfs /dev/vdc1

meta-data=/dev/vdc1 isize=512 agcount=4, agsize=655360 blks

= sectsz=512 attr=2, projid32bit=1

= crc=1 finobt=0 spinodes=0

data = bsize=4096 blocks=2621440, imaxpct=25

= sunit=0 swidth=0 blks

naming =version 2 bsize=4096 ascii-ci=0 ftype=1

log =internal bsize=4096 blocks=2560, version=2

= sectsz=512 sunit=0 blks, lazy-count=1

realtime =none extsz=4096 blocks=0, rtextents=0

data blocks changed from 2621440 to 7864064

root@bj-centos7 ~ #

root@bj-centos7 ~ # df -ht | grep vdc

/dev/vdc1 xfs 30g 33m 30g 1% /vdc1

xfs檔案系統

debain linux核心的 b ubuntu系統安裝xfs b 安裝時候直接可以選擇格式化分割槽為xfs。安裝系統之後的安裝方法也很簡單 apt cache search xfs grep xfs apt get install xfsprogs b redhat安裝xfs b yum list...

xfs檔案系統在lvm下的擴容操作

lvm logical volume manager 邏輯卷管理,可以滿足linux系統動態調整各分割槽大小,滿足伺服器在不同的執行時期的需求。lvm格式下的擴容遵循下列步驟 1.vg 擴容 將新的硬碟或者新的分割槽加入到乙個已經存在的vg中,以 dev sdb為例 pvcreate dev sdb...

xfs檔案系統備份 恢復

xfs提供了xfsdump和xfsrestore工具協助備份xfs 檔案系統中的資料。xfsdump按inode順序備份乙個xfs檔案系統。centos7選擇xfs格式作為預設檔案系統,而且不再使用以前的ext,仍然支援ext4,xfs專為大資料產生,每個單個檔案系統最大可以支援8eb,單個檔案可以...