I'm running Windows in VM on Linux. I have a backing (base) file and upper layer (qcow2). Since last upper layer creation it grew to a large size. I've mounted the disk with guestmount and summed up sizes of files changed during that uptime - that came to about 4 times less than the size of the upper layer file. Why has the layer file got so large?
P.S. commands for reference:
guestmount -a /path/Win_upper.qcow2 -m /dev/sda1 --ro /1 find /1 -mtime -10 -exec stat --format='%n %s' "{}" \; >> a.txt cat a.txt | awk '{print $NF}' | while read l; do a=$(($a+$l));echo $l $a; done
find ... -printf '%p %s\n'is more efficient than-exec stat ...(3) (any)awkcan do arithmeticfsutil fsinfo ntfsinfo c:I've found out cluster size is 4096 bytes. Dividing total of changed files by their number I've got ~600 KB (if VM image size/qty of files = ~2MB), to me it seems you hypothesis is not supported here (thought I have not checked for directory blocks size, could they be many times more?).-mtimeand copied some lines to the site. 2) to improve efficiency of code is a commendable aim, as for this specific task, I've done with what I knew how to write the code quicker andfindwithin guestmounted location itself was taking subjectively ~100 times longer than subsequent processing.