'\" t .\" Title: cryptsetup-luksformat .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.20 .\" Date: 2023-10-28 .\" Manual: Maintenance Commands .\" Source: cryptsetup 2.7.2 .\" Language: English .\" .TH "CRYPTSETUP\-LUKSFORMAT" "8" "2023-10-28" "cryptsetup 2.7.2" "Maintenance Commands" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAME" cryptsetup-luksFormat \- initialize a LUKS partition and set the initial passphrase .SH "SYNOPSIS" .sp \fBcryptsetup \fIluksFormat\fP [] []\fP .SH "DESCRIPTION" .sp Initializes a LUKS partition and sets the initial passphrase (for key\-slot 0), either via prompting or via . Note that if the second argument is present, then the passphrase is taken from the file given there, without the need to use the \-\-key\-file option. Also note that for both forms of reading the passphrase from a file you can give \*(Aq\-\*(Aq as file name, which results in the passphrase being read from stdin and the safety\-question being skipped. .sp You cannot call luksFormat on a device or filesystem that is mapped or in use, e.g., mounted filesystem, used in LVM, active RAID member, etc. The device or filesystem has to be un\-mounted in order to call luksFormat. .sp To use specific version of LUKS format, use \fI\-\-type luks1\fP or \fItype luks2\fP. To use OPAL hardware encryption on a self\-encrypting drive, use \fI\-\-hw\-opal\fP or \fI\-\-hw\-opal\-only\fP. .sp \fB\fP can be [\-\-hash, \-\-cipher, \-\-verify\-passphrase, \-\-key\-size, \-\-key\-slot, \-\-key\-file (takes precedence over optional second argument), \-\-keyfile\-offset, \-\-keyfile\-size, \-\-use\-random, \-\-use\-urandom, \-\-uuid, \-\-volume\-key\-file, \-\-iter\-time, \-\-header, \-\-pbkdf\-force\-iterations, \-\-force\-password, \-\-disable\-locks, \-\-timeout, \-\-type, \-\-offset, \-\-align\-payload (deprecated)]. .sp For LUKS2, additional \fB\fP can be [\-\-integrity, \-\-integrity\-no\-wipe, \-\-sector\-size, \-\-label, \-\-subsystem, \-\-pbkdf, \-\-pbkdf\-memory, \-\-pbkdf\-parallel, \-\-disable\-locks, \-\-disable\-keyring, \-\-luks2\-metadata\-size, \-\-luks2\-keyslots\-size, \-\-keyslot\-cipher, \-\-keyslot\-key\-size, \-\-integrity\-legacy\-padding, \-\-hw\-opal, \-\-hw\-opal\-only]. .sp \fBWARNING:\fP Doing a luksFormat on an existing LUKS container will make all data in the old container permanently irretrievable unless you have a header backup. .SH "OPTIONS" .sp \fB\-\-align\-payload \fP .RS 4 Align payload at a boundary of \fIvalue\fP 512\-byte sectors. .sp If not specified, cryptsetup tries to use the topology info provided by the kernel for the underlying device to get the optimal alignment. If not available (or the calculated value is a multiple of the default) data is by default aligned to a 1MiB boundary (i.e. 2048 512\-byte sectors). .sp For a detached LUKS header, this option specifies the offset on the data device. See also the \-\-header option. .sp \fBWARNING:\fP This option is DEPRECATED and has often unexpected impact to the data offset and keyslot area size (for LUKS2) due to the complex rounding. For fixed data device offset use \fI\-\-offset\fP option instead. .RE .sp \fB\-\-batch\-mode, \-q\fP .RS 4 Suppresses all confirmation questions. Use with care! .sp If the \-\-verify\-passphrase option is not specified, this option also switches off the passphrase verification. .RE .sp \fB\-\-cipher, \-c\fP \fI\fP .RS 4 Set the cipher specification string. .sp \fIcryptsetup \-\-help\fP shows the compiled\-in defaults. .sp If a hash is part of the cipher specification, then it is used as part of the IV generation. For example, ESSIV needs a hash function, while "plain64" does not and hence none is specified. .sp For XTS mode you can optionally set a key size of 512 bits with the \-s option. Key size for XTS mode is twice that for other modes for the same security level. .RE .sp \fB\-\-debug or \-\-debug\-json\fP .RS 4 Run in debug mode with full diagnostic logs. Debug output lines are always prefixed by \fB#\fP. .sp If \-\-debug\-json is used, additional LUKS2 JSON data structures are printed. .RE .sp \fB\-\-disable\-blkid\fP .RS 4 Disable use of blkid library for checking and wiping on\-disk signatures. .RE .sp \fB\-\-disable\-keyring\fP .RS 4 Do not load volume key in kernel keyring and store it directly in the dm\-crypt target instead. This option is supported only for the LUKS2 type. .RE .sp \fB\-\-disable\-locks\fP .RS 4 Disable lock protection for metadata on disk. This option is valid only for LUKS2 and ignored for other formats. .sp \fBWARNING:\fP 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). .RE .sp \fB\-\-force\-password\fP .RS 4 Do not use password quality checking for new LUKS passwords. .sp This option is ignored if cryptsetup is built without password quality checking support. .sp For more info about password quality check, see the manual page for \fBpwquality.conf(5)\fP and \fBpasswdqc.conf(5)\fP. .RE .sp \fB\-\-hash, \-h\fP \fI\fP .RS 4 Specifies the hash used in the LUKS key setup scheme and volume key digest. The specified hash is used for PBKDF2 and AF splitter. .sp The hash algorithm must provide at least 160 bits of output. Do not use a non\-crypto hash like \fBxxhash\fP as this breaks security. Use \fIcryptsetup \-\-help\fP to show the defaults. .RE .sp \fB\-\-header \fP .RS 4 Use a detached (separated) metadata device or file where the LUKS header is stored. This option allows one to store ciphertext and LUKS header on different devices. .sp With a file name as the argument to \-\-header, the file will be automatically created if it does not exist. See the cryptsetup FAQ for header size calculation. .sp The \-\-align\-payload option is taken as absolute sector alignment on ciphertext device and can be zero. .RE .sp \fB\-\-help, \-?\fP .RS 4 Show help text and default parameters. .RE .sp \fB\-\-hw\-opal\fP .RS 4 Format LUKS2 device with dm\-crypt encryption stacked on top HW based encryption configured on SED OPAL locking range. This option enables both SW and HW based data encryption. .RE .sp \fB\-\-hw\-opal\-only\fP .RS 4 Format LUKS2 device with HW based encryption configured on SED OPAL locking range only. LUKS2 format only manages locking range unlock key. This option enables HW based data encryption managed by SED OPAL drive only. .sp \fBNOTE\fP: Please note that with OPAL\-only (\-\-hw\-opal\-only) encryption, the configured OPAL administrator PIN (passphrase) allows unlocking all configured locking ranges without LUKS keyslot decryption (without knowledge of LUKS passphrase). Because of many observed problems with compatibility, cryptsetup currently DOES NOT use OPAL single\-user mode, which would allow such decoupling of OPAL admin PIN access. .RE .sp \fB\-\-integrity \fP .RS 4 Specify integrity algorithm to be used for authenticated disk encryption in LUKS2. .sp \fBWARNING: This extension is EXPERIMENTAL\fP and requires dm\-integrity kernel target (available since kernel version 4.12). For native AEAD modes, also enable "User\-space interface for AEAD cipher algorithms" in "Cryptographic API" section (CONFIG_CRYPTO_USER_API_AEAD .config option). .sp For more info, see \fIAUTHENTICATED DISK ENCRYPTION\fP section in \fBcryptsetup\fP(8). .RE .sp \fB\-\-integrity\-legacy\-padding\fP .RS 4 Use inefficient legacy padding. .sp \fBWARNING\fP: Do not use this option until you need compatibility with specific old kernel. .RE .sp \fB\-\-integrity\-no\-wipe\fP .RS 4 Skip wiping of device authentication (integrity) tags. If you skip this step, sectors will report invalid integrity tag until an application write to the sector. .sp \fBNOTE:\fP Even some writes to the device can fail if the write is not aligned to page size and page\-cache initiates read of a sector with invalid integrity tag. .RE .sp \fB\-\-iter\-time, \-i \fP .RS 4 The number of milliseconds to spend with PBKDF passphrase processing. Specifying 0 as parameter selects the compiled\-in default. .RE .sp \fB\-\-key\-file, \-d\fP \fIname\fP .RS 4 Read the passphrase from file. .sp If the name given is "\-", then the passphrase will be read from stdin. In this case, reading will not stop at newline characters. .sp See section \fINOTES ON PASSPHRASE PROCESSING\fP in \fBcryptsetup\fP(8) for more information. .RE .sp \fB\-\-keyfile\-offset\fP \fIvalue\fP .RS 4 Skip \fIvalue\fP bytes at the beginning of the key file. .RE .sp \fB\-\-keyfile\-size, \-l\fP \fIvalue\fP .RS 4 Read a maximum of \fIvalue\fP 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. .sp This option is useful to cut trailing newlines, for example. If \-\-keyfile\-offset is also given, the size count starts after the offset. .RE .sp \fB\-\-key\-size, \-s\fP \fIbits\fP .RS 4 Sets key size in \fIbits\fP. The argument has to be a multiple of 8. The possible key\-sizes are limited by the cipher and mode used. .sp See /proc/crypto for more information. Note that key\-size in /proc/crypto is stated in bytes. .sp This option can be used for \fIopen \-\-type plain\fP or \fIluksFormat\fP. All other LUKS actions will use the key\-size specified in the LUKS header. Use \fIcryptsetup \-\-help\fP to show the compiled\-in defaults. .RE .sp \fB\-\-key\-slot, \-S <0\-N>\fP .RS 4 For LUKS operations that add key material, this option allows you to specify which key slot is selected for the new key. .sp The maximum number of key slots depends on the LUKS version. LUKS1 can have up to 8 key slots. LUKS2 can have up to 32 key slots based on key slot area size and key size, but a valid key slot ID can always be between 0 and 31 for LUKS2. .RE .sp \fB\-\-keyslot\-cipher \fP .RS 4 This option can be used to set specific cipher encryption for the LUKS2 keyslot area. .RE .sp \fB\-\-keyslot\-key\-size \fP .RS 4 This option can be used to set specific key size for the LUKS2 keyslot area. .RE .sp \fB\-\-label