Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Quick swap question, adding a temporary swap...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
jwm224
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2015
Posts: 101
Location: Pennsylvania

PostPosted: Sat Jun 27, 2015 9:25 pm    Post subject: Quick swap question, adding a temporary swap... Reply with quote

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
View user's profile Send private message
Naib
Advocate
Advocate


Joined: 21 May 2004
Posts: 4464
Location: Removed by Neddy

PostPosted: Sat Jun 27, 2015 9:43 pm    Post subject: Reply with quote

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
_________________
The best argument against democracy is a five-minute conversation with the average voter
Great Britain is a republic, with a hereditary president, while the United States is a monarchy with an elective king
Back to top
View user's profile Send private message
ct85711
Guru
Guru


Joined: 27 Sep 2005
Posts: 441

PostPosted: Sat Jun 27, 2015 9:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 33587
Location: 56N 3W

PostPosted: Sat Jun 27, 2015 10:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
jwm224
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2015
Posts: 101
Location: Pennsylvania

PostPosted: Sat Jun 27, 2015 10:25 pm    Post subject: Reply with quote

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:
Code:
killall firefox

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
View user's profile Send private message
jwm224
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2015
Posts: 101
Location: Pennsylvania

PostPosted: Sat Jun 27, 2015 10:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 33587
Location: 56N 3W

PostPosted: Sat Jun 27, 2015 10:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
ct85711
Guru
Guru


Joined: 27 Sep 2005
Posts: 441

PostPosted: Sat Jun 27, 2015 10:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
jwm224
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2015
Posts: 101
Location: Pennsylvania

PostPosted: Sat Jun 27, 2015 10:38 pm    Post subject: Reply with quote

@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
View user's profile Send private message
jwm224
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2015
Posts: 101
Location: Pennsylvania

PostPosted: Sat Jun 27, 2015 11:40 pm    Post subject: Reply with quote

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.
Code:
free -ht

reads almost 9 gigs now with 1.4 gigs in use.
Wham! The processor is back and sailing at 100%.
Back to top
View user's profile Send private message
jwm224
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2015
Posts: 101
Location: Pennsylvania

PostPosted: Sat Jun 27, 2015 11:41 pm    Post subject: Reply with quote

Thanks all
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum