Archive for May 16th, 2010

How to check Linux SWAP partition disk surface

Sunday, May 16th, 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 🙂