LinuxCommandLibrary

swaplabel

Display or change swap area label and UUID

TLDR

Display the current label and UUID of a swap area

$ swaplabel [path/to/device]
copy
Set the label of a swap area
$ swaplabel -L [new_label] [path/to/device]
copy
Set the UUID of a swap area
$ swaplabel -U [new_uuid] [path/to/device]
copy

SYNOPSIS

swaplabel [options] device

DESCRIPTION

swaplabel prints or changes the label or UUID of a Linux swap area. The device can be a partition or a regular file configured as swap space.
Labels and UUIDs are useful for identifying swap areas in /etc/fstab instead of using device paths, which may change between boots. Using UUIDs is particularly recommended for reliable identification.

PARAMETERS

-L, --label _label_

Set the swap area label
-U, --uuid _uuid_
Set the swap area UUID (use uuidgen to create)
-h, --help
Display help information
-V, --version
Display version information

CAVEATS

The swap area must be inactive (not in use) when changing label or UUID. Requires root privileges. After changing UUID, update /etc/fstab if it references the old UUID. Part of the util-linux package.

SEE ALSO

mkswap(8), swapon(8), swapoff(8), uuidgen(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community