LinuxQuestions.org
Help answer threads with 0 replies.
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 03-09-2012, 04:10 AM   #1
sam845
Member
 
Registered: Mar 2012
Posts: 55

Rep: Reputation: Disabled
swap


hi,

I'm new to linux. I noticed the swap isn't being used: the system monitor shows 0 bytes of swap and /proc/swaps is empty. Yet I have a linux swap partition (as shown in fdisk -l). I even tried mkswap /dev/my_swap_partition but it didn't work either.

Please help.
Thanks.
 
Old 03-09-2012, 04:23 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

It might be that a swap partition is present, but not mounted.

Can you post the output of the following commands:
Code:
cat /etc/fstab
free
fdisk -l
BTW: If swap isn't needed by the system it will not be used (but it should show up when using the appropriate commands).

Hope this helps.
 
Old 03-09-2012, 04:26 AM   #3
sam845
Member
 
Registered: Mar 2012
Posts: 55

Original Poster
Rep: Reputation: Disabled
Thank you very much, that was the issue.
Swapon worked.
How is it possible that it is not mounted by default, and how can I make it so that it is automatically mounted when the computer starts ?
Thanks.

Last edited by sam845; 03-09-2012 at 04:30 AM.
 
Old 03-09-2012, 04:29 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

There should be an entry in your /etc/fstab file that mounts swap during the boot process. Something like this:
Code:
 /dev/sdaX      swap                    swap      pri=1            0     0
X being the appropriate partition.

Hope this helps.
 
Old 03-09-2012, 04:32 AM   #5
sam845
Member
 
Registered: Mar 2012
Posts: 55

Original Poster
Rep: Reputation: Disabled
I have an entry in my /etc/fstab file that says something like this:
UUID=some_uuid none swap sw 0 0
I don't have a pri=1 though.
and I checked that this uuid is indeed the one where the swap is. So how can it be that the swap wasn't mounted during the boot process ?
 
Old 03-09-2012, 04:46 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,
Quote:
Originally Posted by sam845 View Post
I have an entry in my /etc/fstab file that says something like this:
UUID=some_uuid none swap sw 0 0
I don't have a pri=1 though.
and I checked that this uuid is indeed the one where the swap is. So how can it be that the swap wasn't mounted during the boot process ?
Although my example differs from yours, it is also correct and should work.

Have a look at your boot log file(s) to see if anything strange pops up (probably /var/log/dmesg or /var/log/boot). You can also use the dmesg command.

BTW: Is this a one time thing or consistent after every (re)boot?
 
Old 03-09-2012, 05:05 AM   #7
sam845
Member
 
Registered: Mar 2012
Posts: 55

Original Poster
Rep: Reputation: Disabled
hi,

This was consistent so far, but I haven't rebooted yet since I typed that swapon command.

/var/log/dmesg | grep swap and /var/log/boot | grep swap return no result.
dmesg | grep swap shows:
[14435.771470] 0 pages in swap cache
[14435.771478] Free swap = 0kB
[14435.771480] Total swap = 0kB

ps: what do the numbers in [] refer to ?
 
Old 03-09-2012, 05:40 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,
Quote:
Originally Posted by sam845 View Post
This was consistent so far, but I haven't rebooted yet since I typed that swapon command.
If at all possible, reboot the machine to make sure.

Quote:
/var/log/dmesg | grep swap and /var/log/boot | grep swap return no result.
dmesg | grep swap shows:
[14435.771470] 0 pages in swap cache
[14435.771478] Free swap = 0kB
[14435.771480] Total swap = 0kB
I would have expected a line telling you that swap was added, something like this:
Code:
$ dmesg | grep -i swap
Adding 4008208k swap on /dev/sdb2.  Priority:1 extents:1 across:4008208k
You might want to go through the boot files and the output of dmesg by hand, maybe an error is thrown that doesn't contain the swap keyword you are searching for with grep.

Quote:
ps: what do the numbers in [] refer to ?
The numbers shown between the square brackets show the number of seconds that have passed since your last boot.

Hope this helps.
 
Old 03-09-2012, 07:39 AM   #9
sam845
Member
 
Registered: Mar 2012
Posts: 55

Original Poster
Rep: Reputation: Disabled
hi,

so I did reboot.
I still had to manually use the swapon command.
I went through all the dmesg output and didn't find anything peculiar (though I don't understand half of it). In particular, the words 'error' and 'warn' are not present.
Any idea as to what could cause my system not to automatically add the swap partition ?
I only have one drive by the way.

Thanks
 
Old 03-09-2012, 08:42 AM   #10
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

Can you post the output I asked for in post #2?
 
Old 03-09-2012, 09:12 AM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,930

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Is swap the last line in the fstab file?
It could be something as simple as no end of line character.
 
Old 03-09-2012, 10:12 AM   #12
sam845
Member
 
Registered: Mar 2012
Posts: 55

Original Poster
Rep: Reputation: Disabled
No it's not the last line.

/etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=2b772b05-301a-4705-9b8b-52b52c4ec756 / ext4 errors=remount-ro 0 1
# /home was on /dev/sda7 during installation
UUID=32d3f953-711a-4514-8e5b-17b7d3b34104 /home ext4 defaults 0 2
# swap was on /dev/sda6 during installation
UUID=41e7d85c-9bdb-4434-a055-1e7e1124a419 none swap sw 0 0
# sd card for pandaboard
UUID=42e278b3-3255-4a7f-8b1d-441d62b68515 none ext3 noauto 0 0
UUID=84F7-4051 none vfat noauto 0 0




free -m (after using swapon):

total used free shared buffers cached
Mem: 1982 1865 117 0 11 93
-/+ buffers/cache: 760 222
Swap: 3759 203 3555


fdisk -l:

Disk /dev/sda: 150.0 GB, 150041884686 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00030db2

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2431 19530252 83 Linux
/dev/sda2 2431 19451 136757149 5 Extended
/dev/sda5 2432 12040 77095135 83 Linux
/dev/sda6 12040 12512 3951858+ 82 Linux swap / Solaris
/dev/sda7 12512 19451 55702128 83 Linux

Last edited by sam845; 03-09-2012 at 10:13 AM.
 
Old 03-12-2012, 04:40 AM   #13
sam845
Member
 
Registered: Mar 2012
Posts: 55

Original Poster
Rep: Reputation: Disabled
Can someone help me please ?
 
Old 03-12-2012, 08:42 AM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,930

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Have you checked the logs to see if there are any errors?
 
Old 03-12-2012, 10:12 AM   #15
sam845
Member
 
Registered: Mar 2012
Posts: 55

Original Poster
Rep: Reputation: Disabled
Well I'm not sure about which logs you're talking about, I haven't checked all the logs on my system, but I have checked /var/log/dmesg and /var/log/boot, and there was nothing unusual that I could find. In particular, the words 'warning' or 'error' aren't present.
 
  


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
Use Windows pagefile.sys (swap) as Linux swap? bluesword1969 Linux - General 3 02-19-2010 03:35 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


All times are GMT -5. The time now is 04:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration