View previous topic :: View next topic |
Author |
Message |
jwm224 Tux's lil' helper
Joined: 27 May 2015 Posts: 118 Location: Pennsylvania
|
Posted: Sat Jun 27, 2015 9:25 pm Post subject: Quick swap question, adding a temporary swap... |
|
|
I'm bogged down at the moment. I ran out of memory 3Gb and 1.5Gb swap space, compiling LibreOffice.
In the past, when I ran my last setup that had under a gig of memory (878Mb); during the Gentoo installation on my last setup I used Knoppix,
and every time the screen saver would come on the system would freeze. I'd have to restart. The fix was adding an 8Gb flashdrive partitioned as swap.
My questions are this:
Can you have two swap partitions?
And, can I add a temporary swap to a running system to help speed things up?
Anyone have experience with this or tried this in the past?
Jay |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Sat Jun 27, 2015 9:43 pm Post subject: |
|
|
Try a swap file.
Swap partitions were preferred over files due to speed but a lot of the slowdown w.r.t. a file over a partition has gone.
Equally consider using the -bin package _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
ct85711 Veteran
Joined: 27 Sep 2005 Posts: 1791
|
Posted: Sat Jun 27, 2015 9:44 pm Post subject: |
|
|
Yes to all 3 questions.
I actually had to add a second swap partition to help my system out, where the second partition was on a external usb drive. I easily added the swap partition while the system was already running without any issue. All I did, was do the swapon command on the additional swap partition, and the system immediately added it to the total amount of available amount of swap.
From the documentation that I read when I used the additional swap partition, you can make a swap file to be used. However, this I have not done myself, so I don't know how well it works out nor how to make the file.
According to the mkswap man page:
Quote: | To set up a swap file, it is necessary to create that file before initializing it with mkswap, e.g. using a command like
# fallocate --length 8GiB swapfile
Note that a swap file must not contain any holes (so, using cp(1) to create the file is not acceptable). |
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54237 Location: 56N 3W
|
Posted: Sat Jun 27, 2015 10:04 pm Post subject: |
|
|
jwm224,
Swap will not speed things up. It will allow things to complete that would otherwise have triggered the out of memory manager.
Last time I looked, you could have 32 swaps without tweaking the kernel. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
jwm224 Tux's lil' helper
Joined: 27 May 2015 Posts: 118 Location: Pennsylvania
|
Posted: Sat Jun 27, 2015 10:25 pm Post subject: |
|
|
Right now, I'm only using 5.3% of my processor, but all the memory and all the swap is in use.
atop is showing 20.7Mb free, but the system, itself, is in delay, so for all I know that could be information from 20 minutes ago.
I got a few terminal commands past, trying to kill firefox, since I know it can be a resource hog when it comes to memory.
But, the pid listed in atop returned an unknown process.
I tried to run:
but, it's too backed up and not letting me type to the terminal.
I can move the mouse that's about it.
If I could sneak in the command to mount the extra swap device, that would, at least get things moving, and the processor back up to where it should be, right? |
|
Back to top |
|
|
jwm224 Tux's lil' helper
Joined: 27 May 2015 Posts: 118 Location: Pennsylvania
|
Posted: Sat Jun 27, 2015 10:30 pm Post subject: |
|
|
I just looked at the time stamp on atop; it's 30 minutes off, so essentially I'm seeing what was happening 30 minutes ago.
Last edited by jwm224 on Sat Jun 27, 2015 10:31 pm; edited 1 time in total |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54237 Location: 56N 3W
|
Posted: Sat Jun 27, 2015 10:31 pm Post subject: |
|
|
jwm224,
When swap is in use the CPU won,t be doing very much. It will be waiting on data getting moved from the HDD to RAM.
Thats DMA, which is not CPU intensive, so there will be a lot of waiting going on as your builds will become IO bound.
More swap will not make it faster, only avoid the OOM for longer. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
ct85711 Veteran
Joined: 27 Sep 2005 Posts: 1791
|
Posted: Sat Jun 27, 2015 10:31 pm Post subject: |
|
|
it shouldn't hurt to try and see if it helps out if you already have a swap partition already made on something |
|
Back to top |
|
|
jwm224 Tux's lil' helper
Joined: 27 May 2015 Posts: 118 Location: Pennsylvania
|
Posted: Sat Jun 27, 2015 10:38 pm Post subject: |
|
|
@Neddy Gotcha.
@ct85711
I have an 8Gb flashdrive partitioned and ready to mount, if that's what you mean. It's plugged in and waiting. |
|
Back to top |
|
|
jwm224 Tux's lil' helper
Joined: 27 May 2015 Posts: 118 Location: Pennsylvania
|
Posted: Sat Jun 27, 2015 11:40 pm Post subject: |
|
|
That worked.
Nice!
I gained access to the terminal behind the curtain (F1+CTRL+ALT)
I killed firefox. That freed the little memory I needed to give zsh the go ahead (The in between command 2 minute pauses...)
I added the extra temporary swap.
reads almost 9 gigs now with 1.4 gigs in use.
Wham! The processor is back and sailing at 100%. |
|
Back to top |
|
|
jwm224 Tux's lil' helper
Joined: 27 May 2015 Posts: 118 Location: Pennsylvania
|
Posted: Sat Jun 27, 2015 11:41 pm Post subject: |
|
|
Thanks all |
|
Back to top |
|
|
|