NAME
mkswap - set up a Linux swap areaSYNOPSIS
mkswap [options] device [size]DESCRIPTION
mkswap sets up a Linux swap area on a device or in a file.WARNING
The swap header does not touch the first block. A boot loader or disk label can be there, but it is not a recommended setup. The recommended setup is to use a separate partition for a Linux swap area.OPTIONS
-c, --checkCheck the device (if it is a block device) for
bad blocks before creating the swap area. If any bad blocks are found, the
count is printed.
Go ahead even if the command is stupid. This
allows the creation of a swap area larger than the file or partition it
resides on.
Also, without this option, mkswap will refuse to erase the first block on
a device with a partition table.
Suppress output and warning messages.
Specify a label for the device, to
allow swapon(8) by label.
Use exclusive BSD lock for device or file it
operates. The optional argument mode can be yes, no (or 1
and 0) or nonblock. If the mode argument is omitted, it defaults
to yes. This option overwrites environment variable
$LOCK_BLOCK_DEVICE. The default is not to use any lock at all, but
it’s recommended to avoid collisions with systemd-udevd(8) or
other tools.
Specify the page size (in bytes) to
use. This option is usually unnecessary; mkswap reads the size from the
kernel.
Specify the UUID to use. The default is
to generate a UUID. The format of the UUID is a series of hex digits separated
by hyphens, like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The
UUID parameter may also be one of the following:
clear
random
time
clear the filesystem UUID
generate a new randomly-generated UUID
generate a new time-based UUID
Specify the swap-space version. (This option
is currently pointless, as the old -v 0 option has become obsolete and
now only -v 1 is supported. The kernel has not supported v0 swap-space
format since 2.5.22 (June 2002). The new version v1 is supported since 2.1.117
(August 1998).)
Verbose execution. With this option
mkswap will output more details about detected problems during swap
area set up.
Display help text and exit.
Print version and exit.
ENVIRONMENT
LIBBLKID_DEBUG=allenables libblkid debug output.
use exclusive BSD lock. The mode is
"1" or "0". See --lock for more details.
NOTES
The maximum useful size of a swap area depends on the architecture and the kernel version.# dd if=/dev/zero of=swapfile bs=1MiB count=$((8*1024))
SEE ALSO
fdisk(8), swapon(8)REPORTING BUGS
For bug reports, use the issue tracker at <https://github.com/util-linux/util-linux/issues>.AVAILABILITY
The mkswap command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.2022-05-11 | util-linux 2.38.1 |