目錄
- 前期環境
- 調整空間出錯
- 參考鏈接
- 單磁盤擴容原空間
- 添加硬碟的方式擴容
前期環境
lsblk 查看磁盤情況和磁盤的磁區

fdisk 開始預操作磁盤
? [/root] fdisk /dev/sda
歡迎使用 fdisk (util-linux 2.23.2),
更改將停留在記憶體中,直到您決定將更改寫入磁盤,
使用寫入命令前請三思,
命令(輸入 m 獲取幫助):n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
磁區號 (3,4,默認 3):
起始 扇區 (167772160-419430399,默認為 167772160):
將使用默認值 167772160
Last 扇區, +扇區 or +size{K,M,G} (167772160-419430399,默認為 419430399):
將使用默認值 419430399
磁區 3 已設定為 Linux 型別,大小設為 120 GiB
命令(輸入 m 獲取幫助):t
磁區號 (1-3,默認 3):3
Hex 代碼(輸入 L 列出所有代碼):8e
已將磁區“Linux”的型別更改為“Linux LVM”
命令(輸入 m 獲取幫助):p
磁盤 /dev/sda:214.7 GB, 214748364800 位元組,419430400 個扇區
Units = 扇區 of 1 * 512 = 512 bytes
扇區大小(邏輯/物理):512 位元組 / 512 位元組
I/O 大小(最小/最佳):512 位元組 / 512 位元組
磁盤標簽型別:dos
磁盤識別符號:0x000c7e5e
設備 Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 167772159 82836480 8e Linux LVM
/dev/sda3 167772160 419430399 125829120 8e Linux LVM
命令(輸入 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)
正在同步磁盤,
重啟
pvdisplay 查看 PV卷

vgextend 添加新的物理卷到PV卷

增加 VG卷大小

最后,只需要xfs_growfs通知硬碟空間增加即可,
調整空間出錯
resize2fs: Bad magic number in super-block 當嘗試打開 /dev/mapper/vg_node003-lv_root 時 找不到有效的檔案系統超級塊.
原因:Centos7默認安裝的檔案系統是XFS型別而不是ext2/ext3/ext4,它是一種高性能的日志檔案系統,
對于XFS,使用dumpe2fs命令是找不到對應的超級塊,可以使用xfs_info來查看磁區資訊
參考鏈接
單磁盤擴容原空間
- 單磁盤 重啟擴容 https://www.cnblogs.com/lxyuuuuu/p/9717231.html
添加一些其他的內容,以防不時之需備用
添加硬碟的方式擴容
- 多磁盤、多塊硬碟或硬碟磁區,組合成一個VG組 LVM邏輯卷 https://blog.csdn.net/weixin_42350212/article/details/80570211
- 多磁盤、EXT4 How to extend the root partition in LVM https://rbgeek.wordpress.com/2013/01/27/how-to-extend-the-root-partition-in-lvm/
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/117728.html
標籤:Linux
上一篇:02.ubuntu檔案系統結構
下一篇:Linux 常用命令
