Last active
February 11, 2021 08:35
-
-
Save nexus166/cc962080201df2ac435632b2b793e3c9 to your computer and use it in GitHub Desktop.
Revisions
-
nexus166 revised this gist
Aug 31, 2020 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/usr/bin/env bash set -xeuo pipefail DISK="${1}" _DISKNAME="$(basename "${DISK}")" openssl rand 4096 >"${_DISKNAME}.key" yes YES | cryptsetup luksFormat -d "${_DISKNAME}.key" "${DISK}" || true cryptsetup luksOpen -d "${_DISKNAME}.key" "${DISK}" "${_DISKNAME}" pvcreate "/dev/mapper/${_DISKNAME}" vgcreate "${_DISKNAME}-vg" "/dev/mapper/${_DISKNAME}" lvcreate -l 99%FREE -n "${_DISKNAME}-crypt" "${_DISKNAME}-vg" printf '%s %s %s luks,discard,lvm=%s\n' "${_DISKNAME}" "${DISK}" "$(realpath "${_DISKNAME}".key)" "${_DISKNAME}" | tee -a /etc/crypttab -
nexus166 created this gist
Aug 27, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ ## LVM autoinit on boot for LUKS disk ```shell openssl rand 4096 > sdc.key cryptsetup luksFormat -d sdc.key /dev/sdc cryptsetup luksOpen -d sdc.key /dev/sdc sdc pvcreate /dev/mapper/sdc vgcreate sdc-vg /dev/mapper/sdc lvcreate -l 99%FREE -n sdc2T sdc-vg printf 'sdc /dev/sdc /root/sdc.key luks,discard,lvm=sdc\n' >> /etc/crypttab ```