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>.

Install

All systems
curl cmd.cat/mkswap.sh
Debian Debian
apt-get install util-linux
Ubuntu
apt-get install util-linux
Alpine
apk add util-linux
Arch Arch Linux
pacman -S util-linux
image/svg+xml Kali Linux
apt-get install util-linux
CentOS
yum install util-linux
Fedora
dnf install util-linux
Windows (WSL2)
sudo apt-get update sudo apt-get install util-linux
OS X
brew install util-linux
Raspbian
apt-get install util-linux
Docker
docker run cmd.cat/mkswap mkswap powered by Commando

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>.

  • Set up a given swap area:
    sudo mkswap path/to/file
  • Check a partition for bad blocks before creating the swap area:
    sudo mkswap -c path/to/file
  • Specify a label for the partition (to allow `swapon` to use the label):
    sudo mkswap -L label /dev/sda1

© tl;dr; authors and contributors