create volume
cryptsetup luksFormat --type luks2 ~/luks-volume.data --verify-passphrase
inspect
cryptsetup luksDump --type luks2 ~/luks-volume.data
volume usage
open
cryptsetup open --type luks2 ~/luks-volume.data my-volume --key-file ~/luks-volume.keyfile # using keyfile
cryptsetup open --type luks2 ~/luks-volume.data my-volume # using password
close
cryptsetup close my-volume
key management
add
cryptsetup luksAddKey --type luks2 ~/luks-volume.data ~/luks-volume.keyfile-new --key-file ~/luks-volume.keyfile # add keyfile, using keyfile to open header
cryptsetup luksAddKey --type luks2 ~/luks-volume.data ~/luks-volume.keyfile-new # add password, using password to open header
cryptsetup luksAddKey --type luks2 ~/luks-volume.data --verify-passphrase --key-file ~/luks-volume.keyfile # add password, using keyfile to open header
cryptsetup luksAddKey --type luks2 ~/luks-volume.data --verify-passphrase # add password, using password to open header
remove
cryptsetup luksRemoveKey --type luks2 ~/luks-volume.data --key-file ./luks-volume.keyfile # remove keyfile
cryptsetup luksRemoveKey --type luks2 ~/luks-volume.data # remove password
backup
cryptsetup luksHeaderBackup ~/luks-volume.data --header-backup-file ~/luks-volume.header
restore
cryptsetup luksHeaderRestore ~/luks-volume.data --header-backup-file ~/luks-volume.header