You are not logged in.

#1 2008-06-19 15:20:47

Falcata
Member
From: Michiana
Registered: 2008-01-23
Posts: 501
Website

Swap Space Problems (Solved)

A couple days ago, I had tried clearing my swap space by using swapoff and then swapon, because I didn't feel like rebooting my system to clear it.  However, running swapon did not work.  Running sudo swapon -L /dev/sda2 gives me the message "swapon: cannot find the device for /dev/sda2".  So I rebooted, figuring that would fix the problem.  Now, when I booted up my computer this morning, I saw that it apparently didn't work.  When the boot process gets to the part where it activates the swap space, it says "fail."

How do I fix this?

Last edited by Falcata (2008-06-19 17:16:52)

Offline

#2 2008-06-19 15:26:08

gnud
Member
Registered: 2005-11-27
Posts: 182

Re: Swap Space Problems (Solved)

I don't think your disk has the label "/dev/sda2". So using the swapon -L switch seems strange. But I don't know why it doesn't work on startup. Does "sudo swapon -a" work? If not, please post the output and your /etc/fstab.

Offline

#3 2008-06-19 15:39:59

Falcata
Member
From: Michiana
Registered: 2008-01-23
Posts: 501
Website

Re: Swap Space Problems (Solved)

Running "sudo swapon -a" gives me this:

swapon: /dev/sda2: Invalid argument

And here's my /etc/fstab:

#
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0


# /dev/cdrom /mnt/cdrom   iso9660   ro,user,noauto,unhide   0      0
# /dev/dvd /mnt/dvd   udf   ro,user,noauto,unhide   0      0
# /dev/fd0 /mnt/fd0   vfat   user,noauto   0      0
/dev/sda1 /boot ext2 defaults,noatime,nodiratime 0 1
/dev/sda2 swap swap defaults 0 0
/dev/sda3 / ext3 defaults,noatime,nodiratime,data=journal 0 1
/dev/sda4 /home ext3 defaults,noatime,nodiratime,data=journal 0 1

And just in case it's relevant, here's my /etc/mtab:

/dev/sda3 / ext3 rw,noatime,nodiratime,data=journal 0 0
none /dev ramfs rw 0 0
none /proc proc rw 0 0
none /sys sysfs rw 0 0
none /dev/pts devpts rw 0 0
none /dev/shm tmpfs rw 0 0
/dev/sda1 /boot ext2 rw,noatime,nodiratime 0 0
/dev/sda4 /home ext3 rw,noatime,nodiratime,data=journal 0 0
/dev/sr0 /media/Oblivion udf ro,nosuid,nodev,uid=1000 0 0

EDIT: Here's my /proc/partitions, since it's mentioned in the manpage for swapon:

major minor  #blocks  name

   8     0   78125000 sda
   8     1      72292 sda1
   8     2    1052257 sda2
   8     3   38796975 sda3
   8     4   38202570 sda4

Last edited by Falcata (2008-06-19 15:41:24)

Offline

#4 2008-06-19 15:57:35

gnud
Member
Registered: 2005-11-27
Posts: 182

Re: Swap Space Problems (Solved)

Ok, time for stupid questions. Do /dev/sda2 exist? Is it a swap partition? smile

Offline

#5 2008-06-19 16:38:41

sniffles
Member
Registered: 2008-01-23
Posts: 275

Re: Swap Space Problems (Solved)

How about running `mkswap /dev/sda2 && swapon /dev/sda2` ?

Offline

#6 2008-06-19 16:59:03

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: Swap Space Problems (Solved)

sniffles wrote:

How about running `mkswap /dev/sda2 && swapon /dev/sda2` ?

how about checking it's the right partition first!
But if he messes his installation even more this means more posts on this forum and a bigger community (hell, I'm torn apart)

Offline

#7 2008-06-19 17:00:17

Falcata
Member
From: Michiana
Registered: 2008-01-23
Posts: 501
Website

Re: Swap Space Problems (Solved)

Well, it appears to have worked.  Thanks for the help.

Offline

#8 2008-06-19 17:12:06

gnud
Member
Registered: 2005-11-27
Posts: 182

Re: Swap Space Problems (Solved)

If it's fixed, please mark the topic as [SOLVED] smile

Offline

#9 2008-06-19 17:25:58

sniffles
Member
Registered: 2008-01-23
Posts: 275

Re: Swap Space Problems (Solved)

Falcata: One small curiosity, what is the output of

fdisk -l /dev/sda

?

carlocci wrote:
sniffles wrote:

How about running `mkswap /dev/sda2 && swapon /dev/sda2` ?

how about checking it's the right partition first!
But if he messes his installation even more this means more posts on this forum and a bigger community (hell, I'm torn apart)

/etc/fstab seemed to indicate that /dev/sda2 was his designated SWAP partition (i.e. the one he was using as swap before running swapoff). /proc/partitions indicated that /dev/sda2 did in fact exist.

Last edited by sniffles (2008-06-19 17:29:24)

Offline

#10 2008-06-19 18:44:06

Falcata
Member
From: Michiana
Registered: 2008-01-23
Posts: 501
Website

Re: Swap Space Problems (Solved)

Running fdisk gives me this output:

Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x09449bca

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1           9       72292   83  Linux
/dev/sda2              10         140     1052257+  82  Linux swap / Solaris
/dev/sda3             141        4970    38796975   83  Linux
/dev/sda4            4971        9726    38202570   83  Linux

Offline

#11 2008-06-19 19:50:54

sniffles
Member
Registered: 2008-01-23
Posts: 275

Re: Swap Space Problems (Solved)

Looks good. Cheers.

Offline

Board footer

Powered by FluxBB