LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 03-05-2009, 07:26 PM   #1
dhrumantgoradia
Member
 
Registered: Nov 2004
Distribution: CentOS & Ubuntu
Posts: 30

Rep: Reputation: 15
ubuntu swap is not being used


Hello all, my swap partition on Ubuntu 8.04 is not being used. It is Ubuntu Desktop 8.04LTS but i have disabled the GUI and use at as a server.

the following is the output from free -m
Code:
root@mail:/etc# free -m
             total       used       free     shared    buffers     cached
Mem:          1010        952         58          0         17        131
-/+ buffers/cache:        802        207
Swap:            0          0          0
I have also attached a screenshot of htop.

fstab =
Code:
root@mail:/etc# cat fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda1
UUID=f6539e2b-d096-4493-bc0c-63e450a81523 /               ext3    relatime,errors=remount-ro 0       1
# /dev/sda5
UUID=2273bf12-4379-4780-95fb-f02a6bb1f307 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
How do i get ubuntu to start using the swap space?

Thank you
Attached Images
File Type: jpg htop.jpg (117.2 KB, 10 views)
 
Old 03-05-2009, 07:43 PM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
Well, since swap space is only used when it's needed, and you seem to have a Gb of real RAM, you could pull half of your RAM out of your system and force swap to be used.

Or, start several applications so they're running at the same time.

Or use the "suspend" option when logging off - The swap space is used for storage of the RAM image during a "suspend."

All of the above is by way of saying, "Why do you suppose that you aren't using your swap space when it's needed?"
 
Old 03-05-2009, 08:18 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,485

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Let's see if we can be a little more constructive here, shall we.
@dhrumantgoradia, your swap isn't being mounted - hence you're not accessing it. "swapon -s" will tell you if it's mounted. Most likely reason is the UUID doesn't match what is in fstab - any re-run of mkswap will change the UUID. Best bet is to have a look in dmesg for swap related messages.
Try "blkid | grep -i swap" and check the UUID - update fstab in need. You can just issue "swapon /dev/sda5" to get it active for now.
 
Old 03-05-2009, 08:21 PM   #4
dhrumantgoradia
Member
 
Registered: Nov 2004
Distribution: CentOS & Ubuntu
Posts: 30

Original Poster
Rep: Reputation: 15
I have tried running up more applications, as the memory usage maxes out, the computer freezes and hangs. I have to manually restart the box.

So, PTrenholme, NO, i don't suppose i know why I'm not using swap space when needed.

'free -m' shows that available swap space is '0'
 
Old 03-05-2009, 08:28 PM   #5
dhrumantgoradia
Member
 
Registered: Nov 2004
Distribution: CentOS & Ubuntu
Posts: 30

Original Poster
Rep: Reputation: 15
Thank you Guru syg00, for being more constructive and actually trying to help. I will try what you instructed. You are probably right as i restored my ubuntu partition from a backup but re-created the swap in this HDD.

You help is much much appreciated.
 
Old 03-05-2009, 08:45 PM   #6
dhrumantgoradia
Member
 
Registered: Nov 2004
Distribution: CentOS & Ubuntu
Posts: 30

Original Poster
Rep: Reputation: 15
@syg00

You have solved my problem, it was the UUID mis-match. I replaced the UUID for swap in /etc/fstab with the one from 'swapon-s' and a system restart. Hey presto, worked.

THANK YOU
 
Old 03-06-2009, 09:46 AM   #7
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
Sorry

I misread the free -m output since my output was the same, and I thought I was using swap. Turns out I, too, had my swap space inactive. Since this laptop has 3 Gb of memory (It came with vista installed.), I never noticed that swap was off.

Again, sorry for my non-constructive post.
 
Old 03-06-2009, 03:05 PM   #8
dhrumantgoradia
Member
 
Registered: Nov 2004
Distribution: CentOS & Ubuntu
Posts: 30

Original Poster
Rep: Reputation: 15
No problem @PTrenholme, you can use @syg00's post to enable you swap use. Thank you for your input though, it made me think twice too.
 
Old 07-05-2009, 08:24 AM   #9
linuxStudent11
Member
 
Registered: Jun 2007
Posts: 114

Rep: Reputation: 17
This seems to be a bug in the last SEVERAL ubuntu releases, including up to and including Jaunty 9.04.
It is easily duplicated if you rebuild or change your swap file in any way that changes the UUID.
BTW: I think putting the UUID in the fstab is just a TERRIBLE hack.
"Ah, yes. The OLD ones. Yes. I remember the OLD ways."
Not quite the correct quote from "What Are Little Girls Made Of" ... but you get the idea I trust.
;-)
 
  


Reply

Tags
swap, ubuntu, used


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
Ubuntu Server Won't Use Swap File xXCanisLupusXx Linux - Newbie 6 02-16-2009 11:20 AM
SWAP doesn't work in Ubuntu Neo-Leper Ubuntu 15 07-29-2007 12:31 AM
Sharing swap between FC6 and Ubuntu Regulus Ubuntu 4 11-04-2006 08:08 AM
Complete Ubuntu Swap THE RADICAL Ubuntu 4 08-01-2005 08:29 AM
Linux swap / solaris not appearing as swap in Ubuntu? Erik_the_Red Linux - Newbie 1 07-30-2005 01:57 PM


All times are GMT -5. The time now is 11:56 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration