Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try to sudo swapon -a i get this message:

swapon: /dev/sdb4: read swap header failed: Invalid argument

sdb4 is where my swap partition is.

sudo blkid gives back this:

/dev/sdb1: UUID="75622b47-3265-48a6-a697-265b44bdfe55" TYPE="ext4" 
/dev/sdb3: UUID="d638620e-b8b1-49ae-b234-7e89aa0de676" TYPE="ext4" 
/dev/sdb5: UUID="E656-2CAB" TYPE="vfat" 
/dev/mapper/cryptswap1: UUID="83e2e318-eee6-4864-a1c4-330bd16bc6a7" TYPE="swap"

this is the content of fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sdb1 during installation
UUID=75622b47-3265-48a6-a697-265b44bdfe55 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sdb4 during installation
#UUID=86d7eebb-b840-4fb0-a1fc-a84074062cb2 none            swap    sw              0       0
#/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0   
/dev/sdb4        none            swap    sw              0       0
share|improve this question

Execute command sudo fdisk -l. This will list all partition types A swap partition will be listed similar to below in Ubuntu.

/dev/sdb4            7295        8268     7811072   82  Linux swap / Solaris

If you don't see last 2 values '82' and 'Linux Swap' it is not setup as swap partition. Ensure that /dev/sdb4 is not a real partition with real data before turning it in to swap partition since all your data will be lost.

Then do this to create it as swap partition

sudo swapoff -a

sudo /sbin/mkswap /dev/sdb4 (replace with correct partition name if different)

sudo swapon -a

for a detailed help, refer to

share|improve this answer

Simple: you don't have an sdb4 partition! Your swap appears to be on /dev/mapper/cryptswap1. It looks like you setup cryptswap, so you need to fix your fstab to point to the new swap partition, preferably by UUID, not by device name.

share|improve this answer
Kudos to psusi for reading more closely than I did. My answer completely misses the point... – Flimzy Jun 17 '11 at 22:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.