After snapshot-delete, the qcow2 image file size doesn't decrease, isn't
that a waste of disk space?
Would someone please tell me how to decrease the file size when
snapshot-delete, if that's possible?
The image file name of my virtual machine is d0.qcow
As follows:
[root@test1 ]# virsh list
Id Name State
----------------------------------------------------
32 bfbe8ca8-8579-11e2-844a-001018951f48 running
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 3.6G
cluster_size: 65536
[root@test1 ]# ls -lh
total 3.6G
-rw------- 1 qemu qemu 3.6G Apr 12 17:13 d0.qcow
drwx------ 2 root root 4.0K Apr 12 17:12 held
[root@test1 ]# virsh snapshot-list bfbe8ca8-8579-11e2-844a-001018951f48
Name Creation Time State
------------------------------------------------------------
[root@test1 8]# virsh snapshot-create bfbe8ca8-8579-11e2-844a-001018951f48
Domain snapshot 1365758005 created
[root@test1 ]# virsh snapshot-create bfbe8ca8-8579-11e2-844a-001018951f48
Domain snapshot 1365758022 created
[root@test1 bfbe8ca8-8579-11e2-844a-001018951f48]# virsh snapshot-list
bfbe8ca8-8579-11e2-844a-001018951f48
Name Creation Time State
------------------------------------------------------------
1365758005 2013-04-12 17:13:25 +0800 running
1365758022 2013-04-12 17:13:42 +0800 running
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 3.8G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 1365758005 127M 2013-04-12 17:13:25 00:00:53.141
2 1365758022 127M 2013-04-12 17:13:42 00:01:09.508
[root@test1 ]# ls -lh
total 3.9G
-rw------- 1 qemu qemu 3.9G Apr 12 17:14 d0.qcow
drwx------ 2 root root 4.0K Apr 12 17:12 held
[root@test1 ]# virsh snapshot-delete
bfbe8ca8-8579-11e2-844a-001018951f48 1365758022
Domain snapshot 1365758022 deleted
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 3.8G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
0 1970-01-01 08:00:00 00:00:00.000
[root@test1 ]# ls -lh
total 3.9G
-rw------- 1 qemu qemu 3.9G Apr 12 17:14 d0.qcow
drwx------ 2 root root 4.0K Apr 12 17:12 held
[root@test1 ]# virsh snapshot-delete
bfbe8ca8-8579-11e2-844a-001018951f48 1365758005
Domain snapshot 1365758005 deleted
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 3.8G
cluster_size: 65536
[root@test1 ]# ls -lh
total 3.9G
-rw------- 1 qemu qemu 3.9G Apr 12 17:14 d0.qcow
drwx------ 2 root root 4.0K Apr 12 17:12 held
[root@test1 ]# virsh snapshot-create bfbe8ca8-8579-11e2-844a-001018951f48
Domain snapshot 1365758311 created
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 3.8G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 1365758311 252M 2013-04-12 17:18:32 00:05:58.136
[root@test1 ]# ls -lh
total 3.9G
-rw------- 1 qemu qemu 3.9G Apr 12 17:18 d0.qcow
drwx------ 2 root root 4.0K Apr 12 17:12 held
[root@test1 ]# virsh snapshot-create bfbe8ca8-8579-11e2-844a-001018951f48
Domain snapshot 1365758338 created
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 4.1G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 1365758311 252M 2013-04-12 17:18:32 00:05:58.136
2 1365758338 252M 2013-04-12 17:18:58 00:06:24.272
[root@test1 ]# ls -lh
total 4.1G
-rw------- 1 qemu qemu 4.1G Apr 12 17:19 d0.qcow
drwx------ 2 root root 4.0K Apr 12 17:12 held
[root@test1 ]# virsh snapshot-list bfbe8ca8-8579-11e2-844a-001018951f48
Name Creation Time State
------------------------------------------------------------
1365758311 2013-04-12 17:18:31 +0800 running
1365758338 2013-04-12 17:18:58 +0800 running
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 4.1G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 1365758311 252M 2013-04-12 17:18:32 00:05:58.136
2 1365758338 252M 2013-04-12 17:18:58 00:06:24.272
[root@test1 ]# virsh snapshot-delete
bfbe8ca8-8579-11e2-844a-001018951f48 1365758338
Domain snapshot 1365758338 deleted
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 4.1G
cluster_size: 65536
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK
1 1365758311 252M 2013-04-12 17:18:32 00:05:58.136
[root@test1 ]# ls -lh
total 4.1G
-rw------- 1 qemu qemu 4.1G Apr 12 17:20 d0.qcow
drwx------ 2 root root 4.0K Apr 12 17:12 held
[root@test1 ]# virsh snapshot-delete
bfbe8ca8-8579-11e2-844a-001018951f48 1365758311
Domain snapshot 1365758311 deleted
[root@test1 ]# qemu-img info d0.qcow
image: d0.qcow
file format: qcow2
virtual size: 8.0G (8589934592 bytes)
disk size: 4.1G
cluster_size: 65536
[root@test1 ]# ls -lh
total 4.1G
-rw------- 1 qemu qemu 4.1G Apr 12 17:20 d0.qcow
drwx------ 2 root root 4.0K Apr 12 17:12 held
[root@test1 ]# virsh snapshot-list bfbe8ca8-8579-11e2-844a-001018951f48
Name Creation Time State
------------------------------------------------------------