swapon failed: Device or resource busy on mounted disk

I had a similar issue trying to make a swap partition on sda2. My solution was to type

#: swapoff /dev/sda2
#: mkswap /dev/sda2
#: swapon /dev/sda2

This seemed to reset whatever issue I was having. To make sure this worked, use "lsblk" to check the mountpoint.


The problem is not adding the swap; the problem is your assumption that all swap space shows up in the output of df.

Only partition-type data shows up in that, and as you're using in-system swapping, aka a swapfile, it doesn't show up. The swap space was activated by the first swapon you did; you were just looking in the wrong place to confirm that. The second swapon failed, quite rightly, because you can't add the same file a second time. When you looked in /proc/swaps, which is the definitive system summary of all swap space, you saw that your new space was up and running.