How to setup swap on a sd card



I had installed ubuntu with an sd card plugged in and it got formatted as swap device. unfortunately my daughter pulled and formatted to use for carrying files. Now the box is running visibly slower. I want to restore the old setup, where the sd card is designated as swap.
Please, advise how to do?
Thanks everybody


Is this Raspberry PI based setup? Please provide a little bit info about your setup like what kind of computer you got and how did you install it first time?


typically, you’ll need to set up the partiton (your card in this case) you want to swap on using mkswap /dev/sdX and then enable it with swapon /dev/sdX.


it’s a 7 yr old laptop with Lubuntu. the sd card is like ssd while the hd is pretty slow, so it helps a lot.