I have 100gb raw image with only 7gb used data in it: $ qemu-img info from.img image: from.img file format: raw virtual size: 100G (107374182400 bytes) disk size: 100G $ virt-df -h from.img Filesystem Size Used Available Use% from.img:/dev/sda1 98G 7.2G 89G 8%
And try to run virt-sparsify --convert qcow2 from.img from-spars.qcow2 this create temprorary qcow2 image backed by from.img $ qemu-img info /tmp/sparsify388744.qcow2 image: /tmp/sparsify388744.qcow2 file format: qcow2 virtual size: 100G (107374182400 bytes) disk size: 91G cluster_size: 65536 backing file: /vmimages/from.img Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false and when virt-sparsify internally do qemu-img convert -f qcow2 -O 'qcow2' '/tmp/sparsify388744.qcow2' './front-spars.qcow2' it processes it TOO slow ( total time of convert ~2days ). If run pidstat on this qemu-img process pidstat says that it consumes 100% system time $ pidstat -p 29211 1 Linux 5.4.88-1.el7.elrepo.x86_64 (v2210) 04/24/23 _x86_64_ (104 CPU) 19:56:48 UID PID %usr %system %guest %CPU CPU Command 19:56:49 0 29211 0.00 100.00 0.00 100.00 66 qemu-img 19:56:50 0 29211 0.00 100.00 0.00 100.00 42 qemu-img 19:56:51 0 29211 0.00 100.00 0.00 100.00 73 qemu-img When I run perf "record -a -g -F 997 sleep 10" the most top cpu consumer ( after idle ) is qemu-img : | cpuidle_enter_state | intel_idle | --2.78%--intel_idle 28.90% 0.00% qemu-img libpthread-2.17.so [.] 0x00007f515acbaddd | ---0x7f515acbaddd entry_SYSCALL_64_after_hwframe do_syscall_64 __x64_sys_lseek | --28.90%--ksys_lseek shmem_file_llseek | --28.83%--shmem_seek_hole_data | |--24.38%--find_get_entries | | | --0.81%--xas_find | | | --0.62%--xas_load | --3.14%--__pagevec_release | --3.12%--release_pages Why "qemu-img convert" do so many find_get_entries ? How can I speed up this process? -- Dmitry