centos7擴展磁盤空間


1.fdisk -l 查看當前分區

 

2.lsblk 命令: 列出所有可用設備塊信息

3.進行分區 fdisk /dev/sda

 n:創建新分區

 p:創建主分區

 回車:分區編號

 回車:開始磁盤大小;

 回車:結束的磁盤大小

 w:寫入磁盤

 

 

 

小插曲: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)

解決方法:執行下partprobe 命令

然后查看盤符就有了

4.查看卷分組----vgdisplay -v

 

 

 

 

 

 

 主要看 Free 部分,就是可用空間 

5.創建物理卷----pvcreate /dev/sda3

 

    如果此時直接創建出現錯誤----Device /dev/sda3 not found,可以reboot機器即可。

6.查看結果---- pvdisplay

 

7.擴展卷分組----vgextend centos /dev/sda3    (centos_admin是vgdisplay查到的分組名)

centos 這個名稱是和上面的VG Name 一樣的

 

8.查看邏輯卷----lvdisplay

 

 

 

 

 9.擴展邏輯卷----lvextend -L +300G /dev/centos_admin/root 

首先df -h 查看要擴展的

 

可以直接查看具體的目錄掛載位置,有針對性的擴容

然后 lvextend -L + /dev/mapper/centos-root 掛載(掛載擴容是有限制的,

只能擴充物理內存的最大容量

這里的25600是PE的個數(一個4M大小):總大小為53504*4M/1024 約等於99G。)

 

10.最后一步----xfs_growfs /dev/mapper/centos-root

 

11.查看結果----df -h

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM