Install Mkswap On A Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS
Install mkswap
-
Debian
apt-get install util-linuxClick to copy -
Ubuntu
apt-get install util-linuxClick to copy -
Alpine OS
apk add util-linuxClick to copy -
Arch Linux
pacman -S util-linuxClick to copy -
Kali Linux
apt-get install util-linuxClick to copy -
CentOS
yum install util-linuxClick to copy -
Fedora
dnf install util-linuxClick to copy -
Raspbian
apt-get install util-linuxClick to copy -
macOS
brew install util-linuxClick to copy
Sets up a Linux swap area on a device or in a file.
How to use mkswap?
Below are few example commands for mkswap that you can use in the terminal.
Setup a given partition as swap area:sudo mkswap /dev/sdb7Click to copyUse a given file as swap area:sudo mkswap path/to/fileClick to copyCheck a partition for bad blocks before creating the swap area:sudo mkswap -c /dev/sdb7Click to copySpecify a label for the file (to allow `swapon` to use the label):sudo mkswap -L swap1 path/to/fileClick to copy
To install the latest version of mkswap in your favorite operating system just copy the mkswap installation command from above and paste it into terminal. It will download and install the latest version of mkswap 2026 package in your OS.




