I use a swap file (/mnt/swap). The swap works right. I need to get an access to the data stored in. When it's full of data in some part (which I can see typing "free" in terminal), I copy the file to another location and then open it in hex editor. The swap is full of "00" like it were empty (or it actually is?). I'm not advanced user of Linux and probably I'm doing something wrong, but all works when I do the same with /proc/kcore - I can see the data in the copy which was stored in ram during copying.
Moreover, can I try to open my swap file in hex editor when the swap is working (only for read)? Isn't it dangerous?
sudo strings /mnt/swap
-- you just can't be certain where the blocks in the swap file came from. – Johnny Oct 24 '13 at 15:41swapon -s
? This is a very strange way of accessing the memory of a process: it won't work unless the part of memory you're interested is swapped out, and you'll have no indication of which parts of the swap belong to which process. Why not access the process's memory directly? – Gilles 'SO- stop being evil' Oct 24 '13 at 23:24sudo cp /mnt/swap /another/place
. The output ofswapon -s
is:Filename Type Size Used Priority /mnt/swap file 2097148 1031568 -1
. – user49847 Oct 25 '13 at 10:22