The following is the GNU All-permissive License as recommended in

Copyright (C) 2024 Free Software Foundation

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.

Contributions are welcome. See

Set up a self-mounting, encrypted partition

pwgen 128 -s -1 | xargs echo -n > $KEYFILE
echo YES | cryptsetup luksFormat -y --cipher aes-xts-plain64 --hash sha256 --use-urandom --key-size 256  /dev/$1 --key-file=$KEYFILE
echo "$HOSTNAME-crypt-$1 /dev/$1 /boot/key-$1 luks,discard,nofail" >> /etc/crypttab