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

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?
Who is Participating?
wesly_chenConnect With a Mentor Commented:
> 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.
Could you post the result for the following commands for people here to help you:
cat /etc/fstab
fdisk -l
df -h
narcusAuthor Commented:
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)
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Can you run the 'lsmod' command and post it?

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


narcusAuthor Commented:
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]
Ok I'm wondering if the drive in question is USB or external/internal SATA? SCSI?
Good eye Wesley
narcusAuthor Commented:
Thanks to all.
That fixed it.
I'm not sure how it happened...but that is for another day.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.