`qemu-img info` reports an incorrect actual-size when the underlying posix filesystem has transparent compression
Bug #1881648 reported by
Graham Christensen
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Invalid
|
Undecided
|
Unassigned |
Bug Description
qemu-img info reports the same thing as `du`*1024:
$ qemu-img info --output json ./my.qcow2 | jq '."actual-size"'
558619648
$ du ./my.qcow2
545527 ./my.qcow2
$ echo $((558619648 / 545527))
1024
and this is correct in terms of bytes on disk, but due to transparent compression implemented by the filesystem, it is not the actual byte count:
$ du -h --apparent-size ./my.qcow2
1346568192 my.qcow2
To post a comment you must log in.
But that’s the point of that field, to show the amount of space used by the image on the host.
The man page documents it as: “disk size: How much space the image file occupies on the host file system (may be shown as 0 if this information is unavailable, e.g. because there is no file system)”, and the QAPI definition of ImageInfo documents the actual-size field as “actual size on disk in bytes of the image”.
So it is documented as and intended to be the number of bytes used, not the length of the file.
Max