天天看點

GPT磁盤分區擴容

當低版本OS 安裝growpart 工具失敗時,可以使用parted 工具來分區,僅适用于資料盤 (阿裡雲系統盤都是MBR分區)且不适用于EXT3

umount 分區

要停止資料盤相關的服務和程序

擴充分區大小

parted /dev/vd[b-z]

輸入resizepart 1 100% #擴容對應磁盤的第一個分區,将磁盤所有可用空間配置設定給第一個分區

(parted) help resizepart
     resizepart NUMBER END   
NUMBER is the partition number used by Linux.  On MS-DOS disk labels, the primary partitions number from 1 to 4, logical partitions from 5 onwards.
END is disk location, such as 4GB or 10%.  Negative value counts from the end of the disk.  For example, -1s  specifies exactly the last sector.
           

擴充檔案系統

如果是EXT4檔案系統 使用resize2fs /dev/vd<裝置編号><分區編号>

如果是XFS 先挂載然後執行 xfs_growfs <挂載點>