fstab shows swap exists but swapon -s shows nothing. swapon /dev/sda2 replies with  No such device or address

Posted on 2006-11-29
Last Modified: 2012-05-05
fstab shows swap exists but swapon -s shows nothing. swapon /dev/sda2 replies with  No such device or address.
I have tried to mkswap and receive /dev/sda2: No such device or address.
I see the device file in /dev so I do not know why I am receiving the no device error message.
If there are no other ideas, my next step would be to go through the installation and try to delete swap and recreate it. Hopefully this will not destroy the data out there. I really do not want to have to reformat the hard drive and start over.
Any clues before I have to take this step?
Question by:narcus
  • 3
  • 3
  • 2
LVL 38

Expert Comment

ID: 18040239
Could you post the result for the following commands for people here to help you:
cat /etc/fstab
fdisk -l
df -h

Author Comment

ID: 18040282
Here are the results of the commands requested to run.
Thx for the help.

[root@server root]# cat /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/d01              /d01                    ext3    defaults        1 2
none                    /dev/pts                devpts  gid=5,mode=620  0 0
LABEL=/home             /home                   ext3    defaults        1 2
LABEL=/opt              /opt                    ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/tmp              /tmp                    ext3    defaults        1 2
LABEL=/usr              /usr                    ext3    defaults        1 2
LABEL=/var              /var                    ext3    defaults        1 2
/dev/sda2               swap                    swap    defaults        0 0
/dev/cdrom              /mnt/cdrom              udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/cdrom1             /mnt/cdrom1             udf,iso9660 noauto,owner,kudzu,ro 0 0
[root@server root]# fdisk -l

Disk /dev/sda: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sda doesn't contain a valid partition table

Disk /dev/sdb: 35.8 GB, 35836133376 bytes
64 heads, 32 sectors/track, 34176 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1   *         1       500    511984   83  Linux
/dev/sdb2           501      6500   6144000   82  Linux swap
/dev/sdb3          6501     11500   5120000   83  Linux
/dev/sdb4         11501     34176  23220224    f  Win95 Ext'd (LBA)
/dev/sdb5         11501     15500   4095984   83  Linux
/dev/sdb6         15501     17500   2047984   83  Linux
/dev/sdb7         17501     18500   1023984   83  Linux
/dev/sdb8         18501     19000    511984   83  Linux
/dev/sdb9         19001     34176  15540208   83  Linux
[root@server root]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sdb1             485M  237M  224M  52% /
/dev/sdb9              15G  7.6G  6.4G  55% /d01
/dev/sdb7             985M   17M  918M   2% /home
/dev/sdb5             3.9G   88M  3.6G   3% /opt
none                  2.0G     0  2.0G   0% /dev/shm
/dev/sdb8             485M  8.7M  451M   2% /tmp
/dev/sdb3             4.9G  2.0G  2.6G  44% /usr
/dev/sdb6             2.0G  100M  1.8G   6% /var
/dev/vg1/lv1          247G  102G  132G  44% /d02
[root@server root]# mount
/dev/sdb1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbdevfs on /proc/bus/usb type usbdevfs (rw)
/dev/sdb9 on /d01 type ext3 (rw)
/dev/sdb7 on /home type ext3 (rw)
/dev/sdb5 on /opt type ext3 (rw)
none on /dev/shm type tmpfs (rw)
/dev/sdb8 on /tmp type ext3 (rw)
/dev/sdb3 on /usr type ext3 (rw)
/dev/sdb6 on /var type ext3 (rw)
/dev/vg1/lv1 on /d02 type ext3 (rw)
LVL 11

Expert Comment

ID: 18040375
Can you run the 'lsmod' command and post it?

In particular I'm wondering if you are running any of these modules:



Author Comment

ID: 18040592
Here is the output of lsmod.
I do not see any of the entries you questioned.
[root@server root]# lsmod
Module                  Size  Used by    Not tainted
loop                   12728   0  (autoclean)
lvm-mod                65600   3  (autoclean)
ipmi_devintf            5192   1
ipmi_si_drv            28392   1
ipmi_msghandler        29252   0  [ipmi_devintf ipmi_si_drv]
dell_rbu                8128   0
audit                  90872   2  (autoclean)
usbserial              23804   0  (autoclean) (unused)
lp                      9156   0  (autoclean)
parport                38848   0  (autoclean) [lp]
autofs4                17464   0  (autoclean) (unused)
bnx2                  137960   1  (autoclean)
crc32                   3764   0  (autoclean) [bnx2]
sg                     37292   0  (autoclean)
sr_mod                 17880   0  (autoclean)
cdrom                  32896   0  (autoclean) [sr_mod]
usb-storage            75168   0
microcode               6912   0  (autoclean)
keybdev                 2976   0  (unused)
mousedev                5688   1
hid                    22532   0  (unused)
input                   6176   0  [keybdev mousedev hid]
ehci-hcd               20776   0  (unused)
usb-uhci               26860   0  (unused)
usbcore                81344   1  [usbserial usb-storage hid ehci-hcd usb-uhci]
ext3                   90088   8
jbd                    55380   8  [ext3]
megaraid_sas           24732   0
qla2300               766492   1
diskdumplib             5260   0  [qla2300]
sd_mod                 14256  16
scsi_mod              116140   6  [sg sr_mod usb-storage megaraid_sas qla2300 sd_mod]
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

LVL 11

Expert Comment

ID: 18040637
Ok I'm wondering if the drive in question is USB or external/internal SATA? SCSI?
LVL 38

Accepted Solution

wesly_chen earned 500 total points
ID: 18040668
> fidks -l
> Disk /dev/sda doesn't contain a valid partition table

> /dev/sdb2           501      6500   6144000   82  Linux swap

It seems to me that swap is on /dev/sdb2, not /dev/sda2.
Please modify /etc/fstab for swap to /dev/sdb2.
And then mouunt the swap again.
LVL 11

Expert Comment

ID: 18040689
Good eye Wesley

Author Comment

ID: 18040755
Thanks to all.
That fixed it.
I'm not sure how it happened...but that is for another day.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now