CRYPTSETUP-RESIZE(8)

CRYPTSETUP-RESIZE πŸ’…βœ¨

okay bestie, so this is the cryptsetup-resize page from the cryptsetup manual β€” it lives in the Maintenance Commands section of the man pages (that's section 8, iykyk). Sit down, hydrate, we're doing this 🫢


✨ NAME ✨

cryptsetup-resize β€” resize an active mapping. that's it, that's the whole job. she stretches the vibes (and the sectors) πŸ’–


🌸 SYNOPSIS 🌸

cryptsetup resize [<options>] <name>

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically: this resizes an active mapping called <name>. iconic behavior.

If you don't give her --size (that one's counted in 512-byte sectors) or --device-size, she just figures out the size from the underlying device all on her own. no thoughts, just math. πŸ’…

  • For LUKS, that means the size of the underlying device minus the area reserved for the LUKS header β€” you can peep the data payload offset with the luksDump command, fr fr.
  • For a plain crypt device, the whole device size is used. no subtraction, she's simple like that.
Heads up bestie: this does not change the raw device geometry. it just changes how many sectors of the raw device get represented in the mapped device. subtle but important, no cap.

Now here's the tea β˜• β€” if cryptsetup detected a volume key for the active device loaded in the kernel keyring service, the resize action will first try to retrieve the key using a token. Only if that failed would it ask for a passphrase to unlock a keyslot (LUKS) or to derive a volume key again (plain mode). The kernel keyring is used by default for LUKS2 devices. slay. πŸ‘‘

And <options> can be:

[--size, --device-size, --token-id, --token-only,
--token-type, --key-slot, --key-file, --keyfile-size, --keyfile-offset,
--timeout, --disable-external-tokens, --disable-locks,
--disable-keyring, --volume-key-keyring, --verify-passphrase, --timeout,
--external-tokens-path]

πŸŽ€ OPTIONS πŸŽ€

okay this is the long part, but every single one matters, so we're listing ALL of them. no skipping, periodt. ✨

  • --batch-mode, -q β€” Suppresses all confirmation questions. Use with care! πŸ’€

If the --verify-passphrase option is not specified, this option also switches off the passphrase verification.

  • --debug or --debug-json β€” Run in debug mode with full diagnostic logs. Debug output lines are always prefixed by #.

If --debug-json is used, additional LUKS2 JSON data structures are printed.

  • --device-size size[units] β€” Sets the new size of the device. If unset, the real device size is used.

If no unit suffix is specified, the size is in bytes.

Unit suffix can be S for 512 byte sectors, K/M/G/T (or KiB, MiB, GiB, TiB) for units with 1024 base, or KB/MB/GB/TB for 1000 base (SI scale). pick your fighter 🌈

  • --disable-external-tokens β€” Disable loading of plugins for external LUKS2 tokens. bye girl πŸ‘‹
  • --disable-keyring β€” Do not load the volume key in the kernel keyring; store it directly in the dm-crypt target instead. This option is supported only for the LUKS2 type.
  • --disable-locks β€” Disable lock protection for metadata on disk. This option is valid only for LUKS2 and is ignored for other formats.
⚠️ WARNING: Do not use this option unless you run cryptsetup in a restricted environment where locking is impossible to perform (where /run directory cannot be used).
  • --external-tokens-path <absolute path> β€” Override the system directory path where cryptsetup searches for external token handlers (or token plugins). It must be an absolute path (starting with the '/' character).
  • --header <device or file storing the LUKS header> β€” Use a detached (separated) metadata device or file where the LUKS header is stored. This option allows one to store the ciphertext and LUKS header on different devices. separated queen 🧚

For commands that change the LUKS header (e.g., luksAddKey), specify the device or file with the LUKS header directly as the LUKS device.

  • --help, -? β€” Show help text and default parameters.
  • --key-description text β€” Set the key description in the keyring that will be used for passphrase retrieval.
  • --key-file, -d file β€” Read the passphrase from the file.

If the name given is "-", then the passphrase will be read from stdin. In this case, reading will not stop at newline characters.

See section NOTES ON PASSPHRASE PROCESSING in cryptsetup(8) for more information.

  • --keyfile-offset value β€” Skip value bytes at the beginning of the key file.
  • --keyfile-size, -l value β€” Read a maximum of value bytes from the key file. The default is to read the whole file up to the compiled-in maximum that can be queried with --help. Supplying more data than the compiled-in maximum aborts the operation.

This option is useful to cut trailing newlines, for example. If --keyfile-offset is also given, the size count starts after the offset. multi-tasking icon πŸ’…

  • --key-slot, -S <0-N> β€” For LUKS operations that add key material, this option allows you to specify which keyslot is selected for the new key.

The maximum number of keyslots depends on the LUKS version. LUKS1 can have up to 8 keyslots. LUKS2 can have up to 32 keyslots based on keyslot area size and key size, but a valid keyslot ID can always be between 0 and 31 for LUKS2.

  • --size, -b <number of 512 byte sectors> β€” Set the size of the device in sectors of 512 bytes.
  • --timeout, -t seconds β€” The number of seconds to wait before a timeout on passphrase input via terminal. It is relevant every time a passphrase is asked. It has no effect if used in conjunction with --key-file.

This option is useful when the system should not stall if the user does not input a passphrase, e.g., during boot. The default is a value of 0 seconds, which means to wait forever. (romantic, honestly πŸ₯Ή)

  • --token-id β€” Specify what token to use and allow the token PIN prompt to take precedence over the interactive keyslot passphrase prompt. If omitted, all available tokens (not protected by PIN) will be checked before proceeding further with the passphrase prompt.
  • --token-only β€” Do not proceed further with the action if the token-based keyslot unlock failed. Without the option, the action asks for a passphrase to proceed further.

It allows LUKS2 tokens protected by PIN to take precedence over the interactive keyslot passphrase prompt.

  • --token-type type β€” Restrict tokens eligible for operation to a specific token type. Mostly useful when no --token-id is specified.

It allows LUKS2 type tokens protected by PIN to take precedence over the interactive keyslot passphrase prompt.

  • --usage β€” Show short option help.
  • --verify-passphrase, -y β€” When interactively asking for a passphrase, ask for it twice and complain if both inputs do not match. Ignored on input from file or stdin. double-check queen βœ…
  • --version, -V β€” Show the program version.
  • --volume-key-keyring <key description> β€” Use a volume key stored in a keyring. This allows one to open luks and plain device types without giving a passphrase. (no passphrase?? main character energy πŸ”₯)

For LUKS, the key and associated type have to be readable from userspace so that the volume key digest may be verified before activation. For devices in reencryption, the option may be used twice to specify both old and new volume keys.

For PLAIN type, the user must ensure that the key in the keyring is unchanged since activation. Otherwise, reloading the key can cause data corruption after an unexpected key change. πŸ’€ not a drill, bestie.

The <key description> uses keyctl-compatible syntax. This can either be a numeric key ID or a string name in the format %<key type>:<key name>. See also the KEY IDENTIFIERS section of keyctl(1). When no %<key type>: prefix is specified, we assume the key type is user (default type).


πŸ™ˆ REPORTING BUGS πŸ™ˆ

Found a bug? spill it, we're listening 🫢 Report bugs at the cryptsetup mailing list <cryptsetup@lists.linux.dev> or in the Issues project section <https://gitlab.com/cryptsetup/cryptsetup/-/issues/new>.

Please attach the output of the failed command with the --debug option added. receipts, always 🧾


πŸ’œ SEE ALSO πŸ’œ


⭐ CRYPTSETUP ⭐

Part of cryptsetup project <https://gitlab.com/cryptsetup/cryptsetup/>.


and that's the whole page bestie!! πŸ’– this one's from cryptsetup 2.8.8, dated 2026-09-07 β€” shoutout to the cryptsetup project, ily, you ate and left no crumbs πŸŒˆβœ¨πŸ‘‘

πŸ“¦ where this page comes from