6

I'm trying to pinpoint what process(es) is eating swap on my FreeBSD server.

I can only see how much is being used (top) but not what process is swapping its guts out.

I tried searching Google for this but didn't find anything.

Is there a way to display list of swapped data by process natively or by using some external software to achieve this?

Thanks.

4

FreeBSD's ps command prints a W in the state column to indicate that a process is swapped out. By default, ps prints state as the third column, so this will give you what you want:

$ ps ax | awk 'NR==1{print};$3 ~ /W/'

'NR==1{print}' will give you the column headers. Omit it if you don't need or want them.

Note also that FreeBSD's top displays swapped out processes with their name (the final column) surrounded by angle brackets.

  • What does “the process is swapped out” mean? Swapped out isn't a binary thing when it comes to a process. Each individual memory page that belongs to the process may or may not be in swap. – Gilles Oct 9 '16 at 20:51
  • I have been thinking about this, too, @Gilles, but what the @D_Bye wrote above is consistent with the docs. See manpage for ps and extended status W. – Martin Sugioarto Oct 9 '16 at 21:57
  • In this case, that all of a process's pages are paged out. Turns out it's pretty hard to find processes that are only partially paged out... – D_Bye Oct 9 '16 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.