LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-28-2012, 09:09 AM   #1
mosthated
LQ Newbie
 
Registered: May 2012
Posts: 8

Rep: Reputation: Disabled
Swap not being used


Hi all,

I created a swap partition (8 gb as part of a 250 gb drive).

I formatted the partition as swap and enabled it using:

Code:
swapon /dev/sdc1
When I do 'top' or 'free' I can see that the swap is recognized.

Also when I do:

Code:
sudo blkid
i get:

Quote:
/dev/sda1: UUID="f04e6038-4412-46c4-b58d-67bfe3f8eddd" TYPE="ext4"
/dev/sdc1: UUID="88ee73e8-7556-40fa-b696-fbc15161036b" TYPE="swap"
/dev/sdc2: UUID="7cdc90eb-6a72-48bb-965d-d4423f8f2057" TYPE="ext4"
/dev/sdb1: UUID="dc25bafb-adbc-4a65-845c-02c9253a795e" TYPE="ext4"
However, I had to add swapon /dev/sdc1 as a startup service, because it didn't stick.

Also, I never see any programs use the swap memory (it always says 0 under 'used' when i do free).

I have 4 gb internal memory, that is also not fully used. Is that the reason the system doesn't use the swap memory?

Thnx, M0s..
 
Old 06-28-2012, 09:54 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,834

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
I sure there must be a thousand threads that ask this very question.
Not using swap is good - swap is very slow, so the system will only use it when it has to.

Add an entry to fstab for swap and you can remove the swapon each boot.
 
Old 06-28-2012, 10:16 AM   #3
mosthated
LQ Newbie
 
Registered: May 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks for the reply.

Could you please point me in the right direction in what way to edit fstab?

thnx M0s..
 
Old 06-28-2012, 10:34 AM   #4
pharaoh357
LQ Newbie
 
Registered: Jun 2012
Location: Leiria, Portugal
Distribution: Kubuntu and Gentoo
Posts: 8

Rep: Reputation: Disabled
As said you need to add it to your fstab so every time you rebooted the system will mount it and it'll be ready to use.

fstab has the format:

filesystem mount_point filesystem_tye mount_options dump pass
For your case the solution would be:
Code:
/dev/sdc1        none        swap        defaults        0        0
Append the line above to /etc/fstab and issue
Code:
 # mount -a
if you want to use it right away or reboot and it will be avaiable after reboot.

EDIT : Altered the sda1 typo.

Last edited by pharaoh357; 06-28-2012 at 10:48 AM.
 
1 members found this post helpful.
Old 06-28-2012, 10:37 AM   #5
mosthated
LQ Newbie
 
Registered: May 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
just to be sure, in my case, wouldn't it be:

/dev/sdc1 none swap defaults 0 0

(instead of /dev/sda1)

thnx. M0s..
 
Old 06-28-2012, 10:49 AM   #6
pharaoh357
LQ Newbie
 
Registered: Jun 2012
Location: Leiria, Portugal
Distribution: Kubuntu and Gentoo
Posts: 8

Rep: Reputation: Disabled
Yes it should be /dev/sdc1. Sorry about that.
 
1 members found this post helpful.
Old 06-28-2012, 10:28 PM   #7
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mint, OpenBSD
Posts: 11,340
Blog Entries: 12

Rep: Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730Reputation: 2730
Linux swaps only when it needs to.

Here's the clearest explanation I've found on fstab, though it doesn't go into using UUIDs; I think it predates them.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to swap out (to swap area) page frames a process use? entertainyou Linux - Kernel 3 03-23-2011 10:52 PM
Gparted says swap has 5 Gb, grep SwapTotal /proc/meminfo says swap has 800 Mb rickrandall Red Hat 3 02-24-2010 01:09 PM
Linux swap / solaris not appearing as swap in Ubuntu? Erik_the_Red Linux - Newbie 1 07-30-2005 01:57 PM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 02:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 08:58 PM


All times are GMT -5. The time now is 02:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration