How to add a swap drive to your system, in this case I did this for a virtual machine (qemu) running Arch Linux.
See at the bottom for information about the virtual drive for qemu.
List current available to system disks:
List all disks:
Format as swap:
sudo mkswap /dev/vdb
gives back the UUID
Now the new swap disk will be shown when executing this again:
(also give the UUID)
Take the UUID from above and add an entry in /etc/fstab like this:
echo "UUID=56445300-90f5-40b4-860b-99037d0e8aad none swap sw 0 0" |sudo tee -a /etc/fstab
Actiate available swap disks, ie. from fstab or on GPT volume.
sudo swapon -a
Check the swap is available now:
sudo swapon --show
The qemu image I created as “raw”, VirtIO and set the cache mode to “writeback”, this should be fine for swap while being fast too. See explanation here and here.
I also looked at this information about how to add a swap disk.
As always, give me your feedback, I will add information that can help in the future.