一,宿主机扩容虚拟机系统盘
环境 | 文件系统 |
---|---|
CentOS 7 | XFS |
1.1查看虚拟机(以下操作在宿主机上)
[[email protected] ~]# virsh list
4 office-com-ldap-01 running
1.2查看虚拟机系统盘
[[email protected] ~]# virsh domblklist office-com-ldap-01
目标 源
------------------------------------------------
vda /home/office-com-ldap-01/office-com-ldap-01.system.qcow2
hda -
1.3原始系统盘大小
[[email protected] ~]# qemu-img info /home/office-com-ldap-01/office-com-ldap-01.system.qcow2
virtual size: 15G (16106127360 bytes)
[[email protected] ~]# virsh shutdown office-com-ldap-01 很重要要先关闭虚拟机
1.4扩容后
[[email protected] ~]# qemu-img resize /home/office-com-ldap-01/office-com-ldap-01.system.qcow2 +5G
[[email protected] ~]# qemu-img info /home/office-com-ldap-01/office-com-ldap-01.system.qcow2
virtual size: 20G (21474836480 bytes)
[[email protected] ~]# virsh start office-com-ldap-01
二,虚拟机内查看(以下操作在kvm虚拟机中)
2.1查看是否增加
2.2给未分配的空间分区
2.3刷新分区表
[[email protected] ~]# partprobe
2.4添加到卷组(dev/centos/root)
[[email protected] ~]# pvcreate /dev/vda3
Physical volume "/dev/vda3" successfully created.
[[email protected] ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/vda2 centos lvm2 a-- <9.00g 0
/dev/vda3 lvm2 --- 5.00g 5.00g
[[email protected] ~]# vgextend centos /dev/vda3
Volume group "centos" successfully extended
[[email protected] ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 13.99g <5.00g
[[email protected] ~]# lvextend -l +100%FREE /dev/mapper/centos-root
New size given (1279 extents) not larger than existing size (2047 extents)
[[email protected] ~]# xfs_growfs /dev/mapper/centos-root
[[email protected] ~]# df -Th
三,windows打开磁盘管理器点击合并卷就可以了比linux简单
原文地址:https://blog.51cto.com/zhangchengjie/2404253
时间: 2024-11-09 02:42:52