阿里云ECS磁盘在线扩容初体验
环境
- CentOS 7.4
- 仅一块系统盘
操作
控制台上扩容
磁盘空间扩容
文件系统扩容
查看云盘大小
# fdisk -l
Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008d73a
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 209715166 104856559+ 83 Linux
查看云盘分区大小
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 30G 8.1G 79% /
devtmpfs 7.8G 0 7.8G 0% /dev
分区扩容
为系统盘的第一个分区扩容。
# yum -y install cloud-utils-growpart
# export LC_ALL=en_US.UTF-8
# growpart /dev/vda 1
CHANGED: partition=1 start=2048 old: size=83881984 end=83884032 new: size=209713119 end=209715167
扩容文件系统
# resize2fs /dev/vda1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 7
The filesystem on /dev/vda1 is now 26214139 blocks long.
查看云盘分区大小
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 99G 30G 65G 32% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm