cryptsetup-luksUUID - Linux


Overview

cryptsetup-luksUUID is a command-line utility for managing LUKS (Linux Unified Key Setup) encrypted partitions. It allows you to generate unique UUIDs (Universally Unique Identifiers) for LUKS-encrypted devices. These UUIDs are typically used to identify encrypted partitions and are essential for unlocking and managing them.

Syntax

cryptsetup-luksUUID [options]

specifies the block device or file to generate a UUID for.

Options/Flags

| Option | Description | Default |
|—|—|—|
| -h, –help | Display help information | – |
| -v, –version | Print version information | – |
| -t, –timeout | Set timeout for LUKS command execution (in seconds) | 60 |

Examples

Generating a UUID for a LUKS-encrypted partition

cryptsetup-luksUUID /dev/sda2

This will generate a UUID for the LUKS-encrypted partition located at /dev/sda2.

Using the UUID to unlock a LUKS-encrypted partition

cryptsetup luksOpen /dev/sda2 --key-file /path/to/keyfile --luks-uuid <UUID>

Replace <UUID> with the UUID generated using cryptsetup-luksUUID. This unlocks the encrypted partition using the provided key file.

Common Issues

Error: UUID not found

This error indicates that the specified device does not have a LUKS header or the UUID could not be found. Ensure that the device is a LUKS-encrypted partition and try again.

Integration

cryptsetup-luksUUID can be integrated with other Linux commands to automate tasks:

find /dev/disk/by-id/ -type l -exec cryptsetup-luksUUID {} \;

This command generates UUIDs for all LUKS-encrypted partitions found under /dev/disk/by-id/.

Related Commands

  • cryptsetup – Manage LUKS-encrypted devices
  • luksformat – Format and encrypt devices with LUKS
  • luksopen – Open and mount LUKS-encrypted partitions