服务器之家

服务器之家 > 正文

阿里云ecs 硬盘在线扩容详细教程

时间:2021-04-10 14:46     来源/作者:sky_cheng

一、首先在阿里云后台通过在线扩容扩容硬盘

二、登录ecs下载阿里云gdisk工具

[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# yum install gdisk -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package gdisk.x86_64 0:0.8.10-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================
 Package                  Arch                      Version                          Repository               Size
===================================================================================================================
Installing:
 gdisk                    x86_64                    0.8.10-3.el7                     base                    190 k

Transaction Summary
===================================================================================================================
Install  1 Package

Total download size: 190 k
Installed size: 660 k
Downloading packages:
gdisk-0.8.10-3.el7.x86_64.rpm                                                               | 190 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : gdisk-0.8.10-3.el7.x86_64                                                                       1/1 
  Verifying  : gdisk-0.8.10-3.el7.x86_64                                                                       1/1 

Installed:
  gdisk.x86_64 0:0.8.10-3.el7                                                                                      

Complete!

三、下载阿里云growpart工具

[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# yum install cloud-utils-growpart -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package cloud-utils-growpart.noarch 0:0.29-5.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================
 Package                              Arch                   Version                    Repository            Size
===================================================================================================================
Installing:
 cloud-utils-growpart                 noarch                 0.29-5.el7                 base                  27 k

Transaction Summary
===================================================================================================================
Install  1 Package

Total download size: 27 k
Installed size: 61 k
Downloading packages:
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
  Installing : cloud-utils-growpart-0.29-5.el7.noarch                                                          1/1 
  Verifying  : cloud-utils-growpart-0.29-5.el7.noarch                                                          1/1 

Installed:
  cloud-utils-growpart.noarch 0:0.29-5.el7                                                                         

Complete!

四、运行growpart进行扩容分区

首先通过df -h查看当前硬盘挂载信息

[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       197G  4.9G  182G   3% /
devtmpfs        7.8G     0  7.8G   0% /dev
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           7.8G  504K  7.8G   1% /run
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/vdb1       985G  846G   89G  91% /home
tmpfs           1.6G     0  1.6G   0% /run/user/0

发现/dev/vdb1对应的挂载点/home,空间使用91%,需要对/dev/vdb1 的分区进行扩容

[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# growpart /dev/vdb 1
CHANGED: partition=1 start=2048 old: size=2097149952 end=2097152000 new: size=4194301919 end=4194303967
[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# 

五、运行resize2fs命令扩容目标分区文件系统

首先查看文件系统类型

[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Thu Nov 29 03:34:10 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=b98386f1-e6a8-44e3-9ce1-a50e59d9a170 /                       ext4    defaults        1 1
/dev/vdb1                                 /home                   ext4    defaults        0 0
[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# 

/dev/vdb1文件系统类型为ext4,运行如下命令

[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# resize2fs /dev/vdb1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vdb1 is mounted on /home; on-line resizing required
old_desc_blocks = 125, new_desc_blocks = 250
The filesystem on /dev/vdb1 is now 524287739 blocks long.

[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# 

再次查看硬盘

[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       197G  4.9G  182G   3% /
devtmpfs        7.8G     0  7.8G   0% /dev
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           7.8G  504K  7.8G   1% /run
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/vdb1       2.0T  846G  1.1T  46% /home
tmpfs           1.6G     0  1.6G   0% /run/user/0
[root@iZ2ze4hqhlabzt7nqcxfxzZ home]# 

/dev/vdb1的容量已经扩围2.0T,至此在线扩容成功。

以上则是阿里云ecs 硬盘在线扩容详细教程的全部内容,希望对您所帮助,更多云服务器知识请访问服务器之家!

原文地址:https://www.cnblogs.com/sky-cheng/p/14626373.html

相关文章

热门资讯

2022年最旺的微信头像大全 微信头像2022年最新版图片
2022年最旺的微信头像大全 微信头像2022年最新版图片 2022-01-10
蜘蛛侠3英雄无归3正片免费播放 蜘蛛侠3在线观看免费高清完整
蜘蛛侠3英雄无归3正片免费播放 蜘蛛侠3在线观看免费高清完整 2021-08-24
背刺什么意思 网络词语背刺是什么梗
背刺什么意思 网络词语背刺是什么梗 2020-05-22
yue是什么意思 网络流行语yue了是什么梗
yue是什么意思 网络流行语yue了是什么梗 2020-10-11
暖暖日本高清免费中文 暖暖在线观看免费完整版韩国
暖暖日本高清免费中文 暖暖在线观看免费完整版韩国 2021-05-08
返回顶部