Hello,
I am curious why when using virt-sparsify the apparent-size of the file
gets reduced to the actual file size? Is there a way to get the
apparent-size left as the full size?
In the man page for virt-sparsify it has a section on
"IMPORTANT NOTE ABOUT SPARSE OUTPUT IMAGES" and its output seems to
indicate what I would expect where "ls -lh" shows the full apparent size
and "du -sh" shows the actual size. But my actual results from testing
are different.
In the following example input.qcow2 is before sparsify and output.qcow2
is after.
Doing ls reports full size for input but a small size for
the output:
root@testingbox:/tmp/test # ls -lh
total 3.1G
-rw-r--r-- 1 root root 512M Jun 14 22:30 file.img
-rw-r--r-- 1 root root 51G Jun 14 22:30 input.qcow2
-rw-r--r-- 1 root root 790M Jun 14 22:36 output.qcow2
Same when asking du for apparent-size:
root@testingbox:/tmp/test # du -h --apparent-size *
512M file.img
51G input.qcow2
790M output.qcow2
A normal du will show the actual size of the files:
root@testingbox:/tmp/test # du -h *
0 file.img
2.4G input.qcow2
790M output.qcow2
The only way I have found to check the full virtual size of the file
after virt-sparsify is with qemu-img:
root@testingbox:/tmp/test # qemu-img info input.qcow2
image: input.qcow2
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 2.3G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: true
root@testingbox:/tmp/test # qemu-img info output.qcow2
image: output.qcow2
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 789M
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
Thanks!