KVM 相關 disk

2024-11-11 KVM KVM linux

qemu-img convert -f raw -O qcow2 manage manage.qcow2

qcow2 轉 VMDisk

qemu-img convert -f qcow2 -O vmdk zimbra9-ubuntu18.04 zimbra9-ubuntu18.04.vmdk

熱擴展磁碟

sudo virsh blockresize <vm_name> <disk_path> <size_in_bytes>
qemu-img resize /kvm/win10 +20G
qemu-img info /kvm/win10
[sudo] password for jameschang: 
image: /kvm/win10
file format: qcow2
virtual size: 40 GiB (42949672960 bytes)
disk size: 39.8 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: true
    refcount bits: 16
    corrupt: false
    extended l2: false

擴展完記得

# ext4
resize2fs /dev/vda2

使用 qemu-img 進行磁碟縮容

sudo qemu-img resize /var/lib/libvirt/images/develop-pg-node-01.qcow2 60G