Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I have 4GB of ram, and an 8GB swap partition available.

Sometimes I like to see how much memory is used at particular points. And I noticed, that sometimes there is small amounts of swap used (~200kb), although the real memory I have not seen exceed 1GB ever.

Of course I realize that this is not an issue most of the time, as 200kb is like a glass of water in the ocean.

Is it just a reporting error? Cause once I was running Ubuntu from livedisk, and it was showing that it was using a lot of swap.. but when you run in livedisk Ubuntu wouldnt have swap available? (or at least you'd hope it wouldn't just start writing stuff into a hardrive og host PC?). Although there was a swap partition in that machine, could livedisk use it??

share|improve this question

migrated from stackoverflow.com Mar 3 '13 at 20:17

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Luis Alvarado Apr 23 '13 at 0:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
When there's a swap partition available, live systems can (and often will) use it –  knittl Mar 2 '13 at 14:06
    
ok that answers that part. Now.. why would live/native system would go near swap, if there is >3GB of real memory available? –  galdikas Mar 2 '13 at 14:24
add comment

1 Answer 1

up vote 2 down vote accepted

That is a design feature built into the kernel itself. In Linus (Torvalds) we trust!

You can try to adjust some of the behavioral characteristics, but on a low-level, the kernel only considers them suggestions. (google 'swapiness')

Often times, swap can be assumed to reside on hard memory. If a program wants a little extra protection from crashes it might request a temp file be synced to disk (which could end up on swap). Then after a crash, a dirty swap can be detected and some data recovery attempted.

You might be surprised how frequently small amounts of data are written to swap (attempt to mount your swap on an old USB drive and you will feel the pain when it starts blocking!)

share|improve this answer
add comment

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