参考https://help.aliyun.com/document_detail/25452.html?spm=a2c4g.11186623.6.768.3c3777ee5Z7duT
linux系统centos7,内核版本低于3.6
参考一下步骤:
使用fdisk
命令删除旧分区。
- 运行
fdisk -u /dev/vdb
:分区数据盘。 - 输入p:打印分区表。
- 输入d:删除分区。
- 输入p:确认分区已删除。
- 输入w:保存修改并退出。
使用fdisk命令新建分区。
- 运行
fdisk -u /dev/vdb
:分区数据盘。 - 输入p:打印分区表。
- 输入n:新建分区。
- 输入p:选择分区类型为主分区。
- 输入<分区号>:选择分区号。本示例选取了1。
系统提示:WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
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 /dev/xvdc
Error: Partition(s) 1 on /dev/xvdc have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
提示重启,重启之后,扩容命令
# resize2fs /dev/xvdc1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/xvdc1 is mounted on /home; on-line resizing required
old_desc_blocks = 4, new_desc_blocks = 8
The filesystem on /dev/xvdc1 is now 31457024 blocks long.
成功!