commands.sh

mkswap

linux

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 info →

Options (5)

-c, --checkboolean

Check a partition for bad blocks before creating the swap area

Example: sudo mkswap {{[-c|--check]}} {{path/to/file}}
-L, --labelboolean

Specify a label for the partition (to allow `swapon` to use the label)

Example: sudo mkswap {{[-L|--label]}} {{label}} {{/dev/sdXY}}
-U, --uuidboolean

Use the specified UUID

Example: sudo mkswap {{[-U|--uuid]}} {{clear|random|time|UUID_value}}
-s, --sizeboolean

Set up a swap file (for btrfs, see `tldr btrfs filesystem` instead)

Example: sudo mkswap {{[-s|--size]}} {{file_size}} {{[-F|--file]}} {{path/to/swapfile}}
-F, --fileboolean

Set up a swap file (for btrfs, see `tldr btrfs filesystem` instead)

Example: sudo mkswap {{[-s|--size]}} {{file_size}} {{[-F|--file]}} {{path/to/swapfile}}

Examples (5)

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|--check] path/to/file

Specify a label for the partition (to allow `swapon` to use the label)

sudo mkswap [-L|--label] label /dev/sdXY

Use the specified UUID

sudo mkswap [-U|--uuid] clear|random|time|UUID_value

Set up a swap file (for btrfs, see `tldr btrfs filesystem` instead)

sudo mkswap [-s|--size] file_size [-F|--file] path/to/swapfile
made by @shridhargupta | data from tldr-pages