I have more than 30 qemu-kvm process open with different images. Their images where accidentally deleted. I searched and i found out that as the file is still open in a process. It can be still recovered. So i have followed this https://unix.stackexchange.com/questions/297475/accidentally-removed-a-libvirt-image-file-can-i-recreate-it. I stopped the process. Copied the file /proc/pid/fd/19 using dd command.
Here the issue begins.
I copied the file and restored it then restarted the process and now i recovered the file. The whole issue is that when i copy the open descriptor with dd command it takes alot of space. "It shouldn't take any space because after coping it, I kill the process so the descriptor is deleted only the copied file exists so the storage should be the same". I have tried the same accepted answer in a different process. But i used cp command not dd. It didn't take any space after killing the process. Now i want to know where did my space go. I did the restore for more than 20 process with dd command and now my disk is full and i can't do it for the rest of processes. I want to free up the space that dd command took and i will use cp with the rest of processes as it works for me better than dd and it doesn't take any space.
fallocate --dig-holes
. Of course here the target is a file. – A.B Aug 07 '21 at 18:42