KVM虚拟机开机状态在线调整磁盘

  • 查看block信息,获取到磁盘名。 cdn-logs-download为我的虚拟机名

virsh qemu-monitor-command cdn-logs-download --hmp "info block"

  • 直接将磁盘调整到60G, drive-virtio-disk0是上一步中需要扩容的磁盘

virsh qemu-monitor-command cdn-logs-download --hmp "block_resize drive-virtio-disk0 60G"

虚拟机里磁盘扩容

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 install cloud-utils-growpart.x86_64 -y

growpart /dev/vda 2
pvresize /dev/vda2

vgs
lvextend -L +50G   /dev/mapper/centos-root
xfs_growfs /dev/mapper/centos-root
Copyright © 运维知识库 all right reserved,powered by Gitbook文件修订时间: 2023-09-19 10:45:38

results matching ""

    No results matching ""