阿里云ECS服务器的云盘扩容后,即使重新启动云服务器也未能生效,还是老的空间。
在网上找一下操作方法就能扩容了。
[root@iZ8vbfrg7utqqldnq62lwyZ ~]# yum install -y cloud-utils-growpart
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/5): epel/x86_64/group_gz | 96 kB 00:00:00
(2/5): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(3/5): extras/7/x86_64/primary_db | 246 kB 00:00:00
(4/5): epel/x86_64/primary_db | 7.0 MB 00:00:00
(5/5): updates/7/x86_64/primary_db | 14 MB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package cloud-utils-growpart.x86_64 0:0.27-10.el7 will be updated
---> Package cloud-utils-growpart.noarch 0:0.29-5.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================================================
Updating:
cloud-utils-growpart noarch 0.29-5.el7 base 27 k
Transaction Summary
============================================================================================================================================================================================================
Upgrade 1 Package
Total download size: 27 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
cloud-utils-growpart-0.29-5.el7.noarch.rpm | 27 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : cloud-utils-growpart-0.29-5.el7.noarch 1/2
Cleanup : cloud-utils-growpart-0.27-10.el7.x86_64 2/2
Verifying : cloud-utils-growpart-0.29-5.el7.noarch 1/2
Verifying : cloud-utils-growpart-0.27-10.el7.x86_64 2/2
Updated:
cloud-utils-growpart.noarch 0:0.29-5.el7
Complete!
[root@iZ8vbfrg7utqqldnq62lwyZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 33G 4.5G 88% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 1.3M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
[root@iZ8vbfrg7utqqldnq62lwyZ ~]# growpart /dev/vda1
growpart disk partition
rewrite partition table so that partition takes up all the space it can
options:
-h | --help print Usage and exit
--fudge F if part could be resized, but change would be
less than 'F' bytes, do not resize (default: 1048576)
-N | --dry-run only report what would be done, show new 'sfdisk -d'
-v | --verbose increase verbosity / debug
-u | --update R update the the kernel partition table info after growing
this requires kernel support and 'partx --update'
R is one of:
- 'auto' : [default] update partition if possible
- 'force' : try despite sanity checks (fail on failure)
- 'off' : do not attempt
- 'on' : fail if sanity checks indicate no support
Example:
- growpart /dev/sda 1
Resize partition 1 on /dev/sda
must supply partition-number
[root@iZ8vbfrg7utqqldnq62lwyZ ~]# growpart /dev/vda 1
CHANGED: partition=1 start=2048 old: size=83881984 end=83884032 new: size=104855519 end=104857567
[root@iZ8vbfrg7utqqldnq62lwyZ ~]# 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 = 4
The filesystem on /dev/vda1 is now 13106939 blocks long.
[root@iZ8vbfrg7utqqldnq62lwyZ ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 50G 33G 14G 71% /
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 1.3M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup