LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Idle swap partition (https://www.linuxquestions.org/questions/linux-newbie-8/idle-swap-partition-4175528450/)

zetrotrack000 12-16-2014 10:06 AM

Idle swap partition
 
Hi
As usual, I have created swap partition but I have never seen that my system ever use it. Here is an output:
Code:

14:32:42 ~>free -m
              total        used        free      shared  buff/cache  available
Mem:          3855        1782        143        137        1930        1686
Swap:          1023          0        1023

If swap just lies idle then whats the purpose of its creation?

Soadyheid 12-16-2014 10:44 AM

It was mainly used when physical memory was expensive and low capacity, nowadays most new PCs come with up to 8Gb of memory so there's no need for blocks of program to be paged in and out of the swap space on the disk, the whole program can be memory resident.

If, instead of shutting down your laptop you select "sleep", the physical memory contents will be saved to a special file which lives on the swap partition making it quicker to start up. (It doesn't have to boot.) If you use hibernate instead, the contents of physical memory are kept "live" but you've a greater risk of losing work as contents may not be in sync with what's on the disk if the power fails/battery gives up.


Play Bonny!

:hattip:

zetrotrack000 12-16-2014 11:32 AM

Hmm... it means a peson (like me) who do not use either of these two functions (sleep and hibernate) can simply delete the swap partition!

onebuck 12-16-2014 12:08 PM

Member response
 
Hi,

Swap is not just for sleep or hibernation. If you are working with a application that is a memory hog or you have multiple app open with that same app you could logically end up needing swap. If you do not have a swap then when one is needed then things can really hang or cause system issues. With the cost for storage media low per GB then having a swap is not really a issue for large storage. Even with a large memory footprint your system can get to a point where swap would be necessary.

If you do a lot of modeling or applications that do require larger page counts then you had better have a swap. Insurance!
Hope this helps.
Have fun & enjoy!
:hattip:

zetrotrack000 12-16-2014 12:29 PM

Thanks


All times are GMT -5. The time now is 11:04 AM.