SWAP Memory shown 0 used 0 free

Asked by Rajinder Sandhu

installed ubuntu 9.10 and I have reserved 1004 MB for SWAP but system is showing 0 used and 0 free through system monitor..... whereas other memories are showing fine.although system is working fine but why there should be such a problem ?
My system is having following things installed :
Ubuntu release 9.10 (karmic)
Kernel Linux 2.6.31-14-generic
Gnome 2.28.1
Memory 749.7 MB
Processor AMD Athlon XP 2000+

Thanks,
Rajinder Sandhu
Bangalore, India

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Rajinder Sandhu (sandy744) said :
#1

I meant to say swap partition is 1004 MB but what system monitor is showing 0 out of 0 bytes even through gparted it shows iLinux-swap 1004.3 MB used - - unused ---
Hope my problem is understood..
Thanks

Revision history for this message
Thomas Krüger (thkrueger) said :
#2

At first try if you can activate the swap partition manually with "sudo swapon /dev/??" (fill in the right partition name).
If that works check if the partition is listed correctly in /etc/fstab.
If you can activate the swap partition. look for an error message in the kernel ring buffer ("dmesg" to show).

Revision history for this message
Sam_ (and-sam) said :
#3
Revision history for this message
Rajinder Sandhu (sandy744) said :
#4

Dear Thomas and Sam,
I did what you have suggested but my problem is getting worse because......
 gparted says /dev/sda6 as 1004.3 MB used 0 free 0
and created manually that is working on /dev/sda8 1048 MB used 0 available 1048 MB here is the output
dads@dads-desktop:~$ free
             total used free shared buffers cached
Mem: 767644 435240 332404 0 18768 198752
-/+ buffers/cache: 217720 549924
Swap: 1048568 0 1048568
dads@dads-desktop:~$
==========================
here is fstab output:--

dads@dads-desktop:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda9
UUID=ea790781-938b-4a89-9cb5-ca8f51220166 / ext3 relatime,errors=remount-ro 0 1
# /dev/sda8
UUID=44224595-fc98-4583-92d6-d2fe7d51179d none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
## the following entry is created by rajinder as swap was showing nil used nil free
/mnt/1024Mb.swap none swap sw 0 0
dads@dads-desktop:~$
but my problem is why the original created one ie sda6 is not being used even though I tried several time to do swapon and reformat the sda6 but nothing works.. and what to do about this?
Thanks

Revision history for this message
Sam_ (and-sam) said :
#5

Ok,
fstab says Swap is on /dev/sda8
free is recognizing Swap and just shows it isn't used.
Not sure about what's the problem, no need to add a Swap file.

Revision history for this message
Vu Do Quynh (vu-do-quynh) said :
#6

The swap partition is used by Linux whenever the RAM is used up and the system would start to swap files from the RAM to the swap partition (which is not wishable = indicates you're starting to run out of resources or that active processes are too much demanding). SO having the swap being on (not zero) is OK and having being not used (0 used) is also very OK.

One current use of the swap partition is for storing the state of your system and applications when you want to hibernate it (or supend it) and not shutdown it. Then, on resuming, you will find back your work where you'd leaved it. For that your swap size should be at least the size of your RAM (usually it is twice).

Revision history for this message
Rajinder Sandhu (sandy744) said :
#7

You got me wrong>>>>
now I have sway partition /dev/sda6 formatted as swap 1004.3MB and another
created manually dev/sda8 1048 MB whereas my actual size of sda8 is20 GB
and this one is working fine showing some 0.8% being used, where as the
created originally is not doing anything... what to do with this swap
partition of 1004Mb
Thanks

On Mon, Nov 9, 2009 at 6:56 AM, Vu Do Quynh <
<email address hidden>> wrote:

> Your question #88905 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/88905
>
> Vu Do Quynh proposed the following answer:
> The swap partition is used by Linux whenever the RAM is used up and the
> system would start to swap files from the RAM to the swap partition
> (which is not wishable = indicates you're starting to run out of
> resources or that active processes are too much demanding). SO having
> the swap being on (not zero) is OK and having being not used (0 used) is
> also very OK.
>
> One current use of the swap partition is for storing the state of your
> system and applications when you want to hibernate it (or supend it) and
> not shutdown it. Then, on resuming, you will find back your work where
> you'd leaved it. For that your swap size should be at least the size of
> your RAM (usually it is twice).
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+question/88905/+confirm?answer_id=5
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+question/88905
>
> You received this question notification because you are a direct
> subscriber of the question.
>

--
Warm regards,

Rajinder Sandhu
Bangalore
India

Revision history for this message
Vu Do Quynh (vu-do-quynh) said :
#8

OK.

My fault, I didn't read carefully.

You have some issue here: you declared a swap on /dev/sda6 which does not appear in your fstab, then you created manually a swap file on /dev/sda8 that is mounted on /mnt.

Could you provide the output in a terminal of the following command ?

sudo fdisk -l

Revision history for this message
Rajinder Sandhu (sandy744) said :
#9

Dear Vu DO here is the output of fstab and fdisk ....

dads@dads-desktop:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda9
UUID=ea790781-938b-4a89-9cb5-ca8f51220166 / ext3 relatime,errors=remount-ro 0 1
# /dev/sda8
UUID=44224595-fc98-4583-92d6-d2fe7d51179d none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
## the following entry is created by rajinder as swap was showing nil used nil free
/mnt/1024Mb.swap none swap sw 0 0
dads@dads-desktop:~$ sudo fdisk -l
[sudo] password for dads:

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x46f746f6

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 5099 40957686 7 HPFS/NTFS
/dev/sda2 5100 24320 154392682+ f W95 Ext'd (LBA)
/dev/sda5 5100 7649 20482843+ 7 HPFS/NTFS
/dev/sda6 7650 7777 1028128+ 82 Linux swap / Solaris
/dev/sda7 7778 11473 29688088+ 83 Linux
/dev/sda8 11474 14023 20482843+ b W95 FAT32
/dev/sda9 14024 24320 82710621 7 HPFS/NTFS
dads@dads-desktop:~$
Thanks for your valuable time....

Revision history for this message
Vu Do Quynh (vu-do-quynh) said :
#10

OK

In a terminal launch

sudo blkid

it will return you several lines like this one:

/dev/sda2: TYPE="swap" UUID="c070b7da-c217-4b9b-870d-8a21c2715c6c"

Then you can have the UUID (Universal Unique IDentifier) of your /dev/sda6 partition

Launch this command to edit the /etc/fstab

sudo gedit /etc/fstab

Then comment the line /mnt/1024 MB (adding at the beginning of the line the character #

## the following entry is created by rajinder as swap was showing nil used nil free
## /mnt/1024Mb.swap none swap sw 0 0

Then add the following line :

# /dev/sda6
UUID=c070b7da-c217-4b9b-870d-8a21c2715c6c none swap sw 0 0

where you should of course replace the value of the UUID you've got for your /dev/sda6

Save the /etc/fstab file

Then remount all devices with the command:

sudo mount -a

Check that your sda6 has been mounted correctly as swap:with the command 'free'

Then you should be done !

Revision history for this message
Sam_ (and-sam) said :
#11

'free' doesn't say much about partition, to monitor Swap you may also use the cmd:
swapon -s

Revision history for this message
Rajinder Sandhu (sandy744) said :
#12

sudo: egedit: command not found
dads@dads-desktop:~$ sudo gedit /etc/fstab
dads@dads-desktop:~$ sudo mount -a
mount: mount point does not exist
dads@dads-desktop:~$ sudo mount -a
mount: mount point does not exist
dads@dads-desktop:~$ sudo blkid
/dev/sda1: UUID="922C72332C721309" TYPE="ntfs"
/dev/sda5: UUID="84EC249AEC24890E" TYPE="ntfs"
/dev/sda6: UUID="ec46afce-89f3-4efa-97cd-9933dfc12548" TYPE="swap"
/dev/sda7: UUID="ea790781-938b-4a89-9cb5-ca8f51220166" SEC_TYPE="ext2"
TYPE="ext3"
/dev/sda9: UUID="EAA48041A480126D" TYPE="ntfs"
dads@dads-desktop:~$ free
             total used free shared buffers cached
Mem: 767644 708144 59500 0 71084 361536
-/+ buffers/cache: 275524 492120
Swap: 1048568 7124 1041444
dads@dads-desktop:~$ sudo egedit /etc/fstab
sudo: egedit: command not found
dads@dads-desktop:~$ sudo gedit /etc/fstab
dads@dads-desktop:~$ sudo mount -a
dads@dads-desktop:~$
So sda6 is not mounting so i had to comment it out and then work with the
manual swap file only...
any other idea ....do we have ?
Thanks

On Tue, Nov 10, 2009 at 2:01 AM, Sam <email address hidden>wrote:

> Your question #88905 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/88905
>
> Sam posted a new comment:
> 'free' doesn't say much about partition, to monitor Swap you may also use
> the cmd:
> swapon -s
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

--
Warm regards,

Rajinder Sandhu
Bangalore
India

Revision history for this message
Vu Do Quynh (vu-do-quynh) said :
#13

After the second time command "mount -a", if there are no messages like for the first time, it means either it has been succesful or nothing was done.

Did you enter the command 'swapon -s' mentioned by Sam to check if /dev/sda6 was mounted ?

This is the right command to list which partition/file is mounted as swap!

If it is not /dev/sda6, try rebooting and then check with 'swapon -s'

Can you help with this problem?

Provide an answer of your own, or ask Rajinder Sandhu for more information if necessary.

To post a message you must log in.