Jump to content

How do I dump memory to a file on Linux?


vailixi

Recommended Posts

It's usually disabled in the kernel, but if you are root, you should be able to use the dd command like you would for disk copying to save a memory dump if it's enabled. Example:

dd if=/dev/kmem of=/root/kmem

I always forget the dd syntax, and remember it like "data dump input file=/yourfile outputfile=/yourlocationtocopy"

which saves it to "kmem" in /root. If kmem doesn't work, try /dev/mem instead, but again, these could be disabled by default in the kernel. kmem holds the swap file too apparently, so if this is really large, make sure you have the room for everything you want to dump to disk.

​edit: not sure exactly what you were tryign to do, but also came across - http://serverfault.com/questions/173999/dump-a-linux-processs-memory-to-file

if you wanted to attach to a process and dump just that process, which might be useful if thats all you needed.

Edited by digip
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...