growpart--增加磁盘分区空间


centos安装growpart

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
yum search growpart
yum install cloud-utils-growpart.x86_64

 


ubuntu安装

http://www.nonni.cn/index.php/20200403/cid=468.html
sudo apt-get install cloud-initramfs-growroot

 

 

调整分区

growpart /dev/sda 2   增加第2个分区空间,一般对最后一个分区进行调整
pvresize /dev/sda2
lvextend -l +100%FREE /dev/mapper/centos-home
resize2fs /dev/mapper/centos-home
如果是xfs系统类型,需要执行
xfs_growfs /dev/mapper/centos-home

 

参考
https://my.oschina.net/u/4113630/blog/4377160

posted @ 2021-12-27 09:55  坚强的小蚂蚁  阅读(577)  评论(0编辑  收藏  举报