Nov 182013
 

Original article first published in Spanish on http://vidagnu.blogspot.it/

Yesterday I ran into a problem in a SWAP partition on an Astaro Command Center, so I decided to restart with an Ubuntu CD, and my first attempt to repair the system was with the fsck command, but when trying to use it I got the message fsck.swap: command not found

So I check with the badblocks command that the partition had no bad blocks.

sudo badblocks -v /dev/sda2

The above command did not return any error, then searching the Internet I found this simple way to rebuild a damaged swap partition.

sudo swapoff /dev/sda2 
sudo mke2fs -c /dev/sda2

If the above commands do not report any problems and complete successfully, then continue with the following:

sudo mkswap /dev/sda2 
sudo swapon /dev/sda2

Ready, reboot and test, although this process is run in Astaro, applies to any Linux with a similar problem.


Popular Posts:

flattr this!

  2 Responses to “Review and repair a Linux SWAP Partition”

  1. easier, faster, simpler to delete the faulty partition, recreate, and then swapon?
    gparted is your friend… but is it not on the Ubuntu CD?

    • I agree that the process of “check-delete-recreate” does not really fix the error as such. Neither it shows how to fix the disk error(s) if there are any.

 Leave a Reply

(required)

(required)


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>