crypttab — Encrypted device declarations
On systemd-based distributions /etc/crypttab declares encrypted block devices to activate, typically during boot. NAME becomes the mapping name; SOURCE identifies the backing device, preferably with a stable UUID. KEYFILE may be none to request interactive or supported configured key discovery; never store real key bytes in examples. OPTIONS may include luks and noauto; noauto prevents automatic activation through the usual target but other dependencies can still pull in a unit. Distribution initramfs tooling and systemd generators may have different supported options. A mapping is not a mounted filesystem: fstab may reference the mapped device separately. Verify the exact UUID, recovery credentials and backups before changing boot configuration. The sample is fictional and only extracts fields. Do not run cryptsetup or regenerate initramfs on the host for this lab. Restore old crypttab and any affected initramfs via a tested recovery route if an approved VM boot test fails.
Formal Syntax & Structure
NAME SOURCE KEYFILE OPTIONSParameters & Attributes
| Name | Type | Description |
|---|---|---|
| NAME | directive or field | Mapping name |
| SOURCE | directive or field | Backing device |
| KEYFILE | directive or field | Key material location or none |
| OPTIONS | directive or field | Comma-separated activation options |
Return Value
Mapping declaration; no volume opened.
Working Example
set -eud=$(mktemp -d)trap 'rm -rf -- "$d"' EXITprintf 'bmdata UUID=00000000-0000-4000-8000-000000000001 none luks,noauto\n' > "$d/crypttab"awk '{print "mapping=" $1, "key=" $3, "options=" $4}' "$d/crypttab"