How to check Linux SWAP partition disk surface

Sunday, 16th May 2010

My Debian Linux swap partition is not mounting at boot time.I found that really odd and therefore I decided to find outif the swap partition doesn’t have some problems with the swap filesystem or the physical hard disk surface.
My first try was directly with the fsck linux command, though unsuccesful. The error I came across while trying to run fsck on my /dev/sda6 swap partition was:

fsck: fsck.swap: not found
/sbin/fsck: Error 2 while executing fsck.swap for /dev/sda6

What a set back … So I tried next issuing the badblocks command in order to physically check my physical swap partition state:

In short, if you are looking for a way to test some ext2, ext3 or reiserfs or any other linux or unix partition for bad blocks from your linux then you certainly should look at badblocks manual page.

I was lucky the result from badblocks has proven I have no physical issues with my hard drive, as you can see in below’s output generated by the badblocks’s command:

Checking blocks 0 to 1950447
Checking for bad blocks (read-only test): done
Pass completed, 0 bad blocks found.

After reading some http://linuxquestions.org forums I realized there is another way to approach the problem using few other commands as follows:

debian:~# swapoff /dev/sda6
debian:~# mke2fs -c /dev/sda6
# if there are no errors after the above 2 commands are completed then issue:
debian:~# mkswap /dev/sda6
debian:~# swapon /dev/sda6

Well I guess that’s the end of the post 🙂

Share this on:

Download PDFDownload PDF

Tags:

4 Responses to “How to check Linux SWAP partition disk surface”

  1. Unknown says:
    Epiphany 2.29.92 Epiphany 2.29.92 Debian GNU/Linux x64 Debian GNU/Linux x64
    Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.29.92

    Non sense 🙂

    View CommentView Comment
  2. Zakopane says:
    Opera 9.64 Opera 9.64 Windows XP Windows XP
    Opera/9.64(Windows NT 5.1; U; en) Presto/2.1.1

    Seeing this website truly made me to discover something now. Thanks a lot for writing this info.

    View CommentView Comment
  3. Stephen Braithwaite says:
    Firefox 21.0 Firefox 21.0 Ubuntu x64 Ubuntu x64
    Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:21.0) Gecko/20100101 Firefox/21.0

    Seems like a good idea!
    BUT …
    You left out one "-c", and one -v.  It should be:-
    mke2fs -v -c -c /dev/sda6

    Use two "-c" otherwise it really does not do proper bad-blocking.

    Use a "-v" otherwise it will quietly fix the errors and you still wont know.

    View CommentView Comment

Leave a Reply

CommentLuv badge