mkswap

Set up a Linux swap area on a device or in a file. Note: path/to/file can either point to a regular file or a swap partition. More information: https://manned.org/mkswap.

sudo mkswap path/to/file

sudo mkswap -c path/to/file

sudo mkswap -L label /dev/sda1