Based on this question : How to disable swap files in ESXi?.
The main answer states that it is possible to extract data from the swap files (for exemple using strings) so I tried to make a simple copy of the file, but ESXi puts a lock on it. The exact error is Device or resource busy
Here is what i got from vmkfstools -D:
Lock [type 10c00001 offset 45031424 v 499, hb offset 3256320
gen 51, mode 1, owner 54e48032-69f209cc-06f6-c454440c07d0 mtime 30417
num 0 gblnum 0 gblgen 0 gblbrk 0]
Addr <4, 83, 172>, gen 498, links 1, type reg, flags 0, uid 0, gid 0, mode 600
len 4294967296, nb 4096 tbz 0, cow 0, newSinceEpoch 4096, zla 3, bs 1048576
The only way to remove the lock is to poweroff the virtual machine, but if I do, the file is deleted. That is why I am wondering, is it possible to remove the lock, or to prevent the deletion of the file?
I could not ask drectly on the thread because I do not have enough points to comment but I think it deserves an entire question. What are the possibilities to retrieve this file.
EDIT : A first suggestion is to simply delete the lock, either by killing all processes using the file (cannot be done for me), or using something like flock. It isn't installed on ESXi so it is not a valid option I am afraid
Another idea is to lock the file between the time it is unlocked, and the deletion, I have not tried this yet, still lookin for a way to lock/unlock any file