crypttab - static information about encrypted filesystems
| Use Case | Command | Description |
|---|---|---|
| Encrypted swap device | cswap /dev/sda6 /dev/urandom plain,cipher=aes-xts-plain64,size=256,hash=sha1,swap | Creates a swap device on top of encrypted dm-crypt using a random key. |
| LUKS device with interactive password and discard | cdisk0 UUID=123... none luks,discard | Unlocks a LUKS device identified by UUID, prompts for password, enables TRIM. |
| TrueCrypt device with interactive password | tdisk0 /dev/sr0 none tcrypt,discard | Opens a TrueCrypt device, allows discards. |
| Plain dm-crypt with check script and retries | cdisk1 /dev/sda2 none plain,β¦,check,checkargs=ext4,tries=5,discard | Encrypted ext4 device with filesystem verification and 5 retries. |
| Custom check script, no retries | cdisk2 /dev/sdc1 none plain,β¦,check=customscript,tries=1,discard | Uses a custom verification script; fails after one try. |
| Plain dm-crypt with Twofish cipher | cdisk3 /dev/sda3 none plain,cipher=twofish,size=256,hash=ripemd160,discard | Alternative cipher/hash combination for plain dm-crypt. |
The file /etc/crypttab contains descriptive information about encrypted devices. crypttab is only read by programs (e.g. cryptdisks_start and cryptdisks_stop), and not written; it is the duty of the system administrator to properly create and maintain this file. crypttab entries are treated sequentially, so their order matters (dependencies need to be listed first).
Each encrypted device is described on a separate line. Fields on each line are separated by tabs or spaces. Lines starting with '#' are comments, and blank lines are ignored. Octal sequences \0num within a field are decoded, which can be used for values containing spaces or special characters. A backslash which doesn't start an octal sequence yields undefined behavior.
The first field, target, describes the mapped device name. It must be a plain filename without any directory components. A mapped device which encrypts/decrypts data to/from the source device will be created at /dev/mapper/target by cryptsetup.
The second field, source device, describes either the block special device or file that contains the encrypted data. Instead of giving the source device explicitly, the UUID (resp. LABEL, PARTUUID and PARTLABEL) is supported as well, using βUUID=<uuid>β (resp. βLABEL=<label>β, βPARTUUID=<partuuid>β and βPARTLABEL=<partlabel>β).
The third field, key file, describes the file to use as a key for decrypting the data of the source device. In case of a keyscript, the value of this field is given as argument to the keyscript. Note that the entire key file will be used as the passphrase; the passphrase must not be followed by a newline character.
It can also be a device name (e.g. /dev/urandom), note however that LUKS requires a persistent key and therefore does not support random data keys.
If the key file is the string none, a passphrase will be read interactively from the console. In this case, the options check, checkargs and tries may be useful.
The fourth field, options, is an optional comma-separated list of options and/or flags describing the device type (luks, tcrypt, bitlk, or plain which is also the default) and cryptsetup options associated with the encryption process. The supported options are described below. For plain dm-crypt devices the cipher, hash and size options are required. Some options can be changed on active mappings using cryptsetup refresh [<options>] <name>. Furthermore some options can be permanently written into metadata of LUKS2 headers using cryptsetup's --persistent flag.
Note that the first three fields are required and that a missing field will lead to unspecified behaviour.
Please note that there are several independent cryptsetup wrappers with their own crypttab format. This manpage covers Debian's implementation for initramfs scripts and SysVinit init scripts. systemd brings its own crypttab implementation. We try to cover the differences between the systemd and our implementation in this manpage, but if in doubt, better check the systemd crypttab(5) manpage, e.g. online at https://www.freedesktop.org/software/systemd/man/crypttab.html.
cipher=<cipher> β Encryption algorithm (ignored for LUKS and TCRYPT devices). See cryptsetup -c.size=<size> β Encryption key size (ignored for LUKS and TCRYPT devices). See cryptsetup -s.sector-size=<bytes> β Sector size. See cryptsetup(8) for possible values and the default.hash=<hash> β Hash algorithm (ignored for LUKS and TCRYPT devices). See cryptsetup -h.offset=<offset> β Start offset (ignored for LUKS and TCRYPT devices). Uses cryptsetup -o.skip=<skip> β Skip sectors at the beginning (ignored for LUKS and TCRYPT devices). Uses cryptsetup -p.keyfile-offset=<keyfile-offset> β Number of bytes to skip at the start of the key file.keyfile-size=<keyfile-size> β Maximum number of bytes to read from the key file. Default is whole file up to compiled-in maximum. Ignored for plain dm-crypt (key size from size option).keyslot=<slot> / key-slot=<slot> β Key slot (ignored for non-LUKS). See cryptsetup -S.header=<path> β Detached header file (ignored for plain dm-crypt). See cryptsetup --header.verify β Verify password. Uses cryptsetup -y.readonly / read-only β Set up a read-only mapping.tries=<num> β Number of unlock attempts before failing. Default 3; βtries=0β means infinite. Useful with passphrase or keyscript.discard β Allow discards (TRIM) requests. β οΈ Security: may leak filesystem type and used space. Added by default in Debian 10+ for new dm-crypt devices.luks β Force LUKS mode. Ignores cipher=, hash=, size= (provided by header).plain β Force plain encryption mode (default).bitlk β Force BITLK (Windows BitLocker) mode. β οΈ Experimental.tcrypt β TrueCrypt mode. Ignores cipher=, hash=, keyfile-offset=, keyfile-size=, size=.veracrypt / tcrypt-veracrypt β VeraCrypt extension to TrueCrypt. Use with tcrypt.tcrypthidden / tcrypt-hidden β Use hidden TCRYPT header (ignored for non-TCRYPT).same-cpu-crypt β Perform encryption on same CPU that submitted IO.submit-from-crypt-cpus β Disable offloading writes to separate thread.no-read-workqueue / no-write-workqueue β Bypass dm-crypt workqueue; process synchronously.swap β Run mkswap on the created device. Ignored for initramfs devices.tmp[=<tmpfs>] β Run mkfs with filesystem type (default ext4) on the device. Ignored for initramfs.check[=<check>] β Run a check program on the target device; close on failure. Program path or relative to /lib/cryptsetup/checks/. Default from CRYPTDISKS_CHECK (blkid). Debian-specific, not supported by systemd.checkargs=<arguments> β Pass arguments to the check script. Debian-specific.initramfs β Process device in initramfs (root, resume, or marked). Allows remote unlocking. Debian-specific.noearly β Ignore device during first invocation of cryptsetup init scripts (before lvm, raid). Ignored for initramfs. Debian-specific.noauto β Ignore device at boot; can still be mapped manually via cryptdisks_start. Ignored for initramfs. Debian-specific.loud β Print warnings if device does not exist. Overrides quiet. Ignored for initramfs. Debian-specific.quiet β Do not print warnings if device does not exist. Overrides loud. Ignored for initramfs. Debian-specific.keyscript=<path> β Execute the given path with the third field as argument; output used as key. Environment variables: CRYPTTAB_NAME, CRYPTTAB_SOURCE, CRYPTTAB_KEY, CRYPTTAB_OPTIONS, CRYPTTAB_OPTION_<option>, CRYPTTAB_TRIED. β οΈ With systemd as init, this option may be ignored (use initramfs). Debian-specific.blkid β Checks for known filesystem. Accepts argument via checkargs:
"none": succeeds if no valid filesystem."ext4" (or other type): succeeds if that filesystem type is found.un_blkid β Checks for no known filesystem. Accepts argument:
"ext4" (etc.): succeeds if that filesystem type is NOT found.# Encrypted swap device
cswap /dev/sda6 /dev/urandom plain,cipher=aes-xts-plain64,size=256,hash=sha1,swap
# Encrypted LUKS disk with interactive password, identified by its UUID, discard enabled
cdisk0 UUID=12345678-9abc-def012345-6789abcdef01 none luks,discard
# Encrypted TCRYPT disk with interactive password, discard enabled
tdisk0 /dev/sr0 none tcrypt,discard
# Encrypted ext4 disk with interactive password, discard enabled
# - retry 5 times if the check fails
cdisk1 /dev/sda2 none plain,cipher=aes-xts-plain64,size=256,hash=sha1,check,checkargs=ext4,tries=5,discard
# Encrypted disk with interactive password, discard enabled
# - use a nondefault check script
# - no retries
cdisk2 /dev/sdc1 none plain,cipher=aes-xts-plain64,size=256,hash=sha1,check=customscript,tries=1,discard
# Encrypted disk with interactive password, discard enabled
# - Twofish as the cipher, RIPEMD-160 as the hash
cdisk3 /dev/sda3 none plain,cipher=twofish,size=256,hash=ripemd160,discard
CRYPTDISKS_ENABLE β Set to yes (default) to run cryptdisks initscripts at startup; no to disable.CRYPTDISKS_MOUNT β Mountpoints (from /etc/fstab) to mount before cryptdisks is invoked. Useful for keys on removable media. Default unset.CRYPTDISKS_CHECK β Default checkscript to run against target device. Used when check option is given without value. Default is blkid.Upstream defaults for encryption cipher, hash and keysize have changed several times and may change again. For LUKS devices, settings are stored in the header and don't need configuration. For plain dm-crypt devices, no such information is stored; therefore we strongly suggest to configure cipher, hash and keysize in /etc/crypttab for plain devices, even if they match current defaults.
/usr/share/doc/cryptsetup-initramfs/README.initramfs.gzThis manual page was originally written by Bastian Kleineidam <calvin@debian.org> for the Debian distribution of cryptsetup. It has been further improved by Michael Gebetsroither <michael.geb@gmx.at>, David HΓ€rdeman <david@hardeman.nu> and Jonas Meurer <jonas@freesources.org>.
cryptsetup 2:2.4.3-1ubunt 2024-11-14 CRYPTTAB(5)
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-14 13:58 @216.73.216.249
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)