1、查看kvm镜像的格式信息
[[email protected] bakup]# qemu-img info 10.1.12.201_base-12-201 image: 10.1.12.201_base-12-201 file format: qcow2 virtual size: 200G (214748364800 bytes) disk size: 88G cluster_size: 65536
2、给镜像增加100G空间
[[email protected] bakup]# qemu-img resize 10.1.12.201_base-12-201 +100G Image resized. [[email protected] bakup]# qemu-img info 10.1.12.201_base-12-201 image: 10.1.12.201_base-12-201 file format: qcow2 virtual size: 300G (322122547200 bytes) disk size: 88G cluster_size: 65536
3、给镜像减少100G空间
qcow2格式降低空间
[[email protected] bakup]# qemu-img resize 10.1.12.201_base-12-201-- -100G This image format does not support resize
由于qcow2格式不支持空间减少,所以要使用raw格式。
[[email protected] bakup]# qemu-img convert -O raw 10.1.12.201_base-12-201 10.1.12.201_base-12-201.raw
查看镜像信息
[[email protected] bakup]# qemu-img info 10.1.12.201_base-12-201.raw image: 10.1.12.201_base-12-201.raw file format: raw virtual size: 300G (429496729600 bytes) disk size: 88G [[email protected] bakup]# qemu-img resize 10.1.12.201_base-12-201.raw -- 100G Image resized. [[email protected] bakup]# qemu-img info 10.1.12.201_base-12-201.raw image: 10.1.12.201_base-12-201.raw file format: raw virtual size: 200G (214748364800 bytes) disk size: 88G
转换为qcow2
[[email protected] bakup]# qemu-img convert -O qcow2 10.1.12.201_base-12-201.raw 10.1.12.201_base-12-201.qcow2 [[email protected] bakup]# qemu-img info 10.1.12.201_base-12-201.qcow2 image: 10.1.12.201_base-12-201.qcow2 file format: qcow2 virtual size: 200G (214748364800 bytes) disk size: 88G
原文地址:http://blog.51cto.com/wangpengtai/2066460
时间: 2024-10-31 23:04:50