LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Impossible to use swap (https://www.linuxquestions.org/questions/linux-hardware-18/impossible-to-use-swap-843012/)

kususe 11-08-2010 07:08 AM

Impossible to use swap
 
I have a problem with my swap on my Debian Squeeze.
This is the output of "free -m"

Code:

  total      used      free    shared    buffers    cached
Mem:          501        491        10          0        28        256
-/+ buffers/cache:        206        295
Swap:            0          0          0

this is my /etc/fstab

Code:

# /etc/fstab: static file system information.
#
# Use 'vol_id --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    defaults        0      0
# / was on /dev/hda1 during installation
UUID=0817464a-4ce5-4691-969e-909096babd34 /              ext4    errors=remount-ro 0      1
# /home was on /dev/hda2 during installation
UUID=876840e1-5af7-4c91-80b3-9e5187cdbddf /home          ext4    defaults        0      2
# swap was on /dev/hda3 during installation
UUID=aa037805-a2f5-443e-89f0-fe60cd57f996 none            swap    sw              0      0

this is what I obtain when I use "swapon -a":

Code:

swapon: cannot find the device for UUID=aa037805-a2f5-443e-89f0-fe60cd57f996
Suggestions?

ronlau9 11-08-2010 07:15 AM

The command ls-l /dev/disk/by-uuid gives the partitions of the disk and its UUID
You can find out if the UUID of the swap partition has changed or do not exist any more
If the swap file is gone you can create a new one

Linux.tar.gz 11-08-2010 07:16 AM

Use blkid in order to get id of drives/partitions.
Then make changes in fstab. Reboot (you can also use swapon for immediate use).

johnsfine 11-08-2010 07:19 AM

I haven't used vol_id before myself. I just tried it on a Centos system. I'm not sure it is in the same place on Debian. But this command (as root) may give the info you need:
Code:

/lib/udev/vol_id --uuid /dev/sd*
Edit: While I was testing/typing that others posted suggestions that look at least as good as my suggestion.

Any of those methods should tell you whether you have a swap partition and if so whether it has a UUID and what that is.

It is possible you have an unitialized swap partition, so you would need to use the mkswap command to initialize it before it can be used. See the man page for mkswap.

Didier Spaier 11-08-2010 07:25 AM

It's a bit surprizing that the UUID of the partition have changed.

Anyhow try fdisk -l /dev/hda or if unsuccessfull fdisk -l /dev/sda.

Then in /etc/fstab replace the UUID of your swap partition by its device name given by the cfdisk command and reboot.

kususe 11-11-2010 09:12 AM

Ok solved.
Uuid in "/etc/fstab" was changed. I copied the Uuid of swap of "blkid" output in /etc/fstab and now it's ok.
Thanks to everybody.


All times are GMT -5. The time now is 06:30 AM.