How To Mount LUKS


This code is meant to be a trenchant example of the essential actions necessary. You are crazy and I am not responsible if you copy and paste.

  • Mount LUKS:
    apt install cryptsetup
    LUKS_BLKDEV=$(blkid | grep crypto_LUKS | cut -d ':' -f 1)
    cryptsetup luksOpen ${LUKS_BLKDEV} root
    # Enter passphrase
    mkdir /mnt/root && mount /dev/mapper/root /mnt/luks_root  # Skip this step if `/dev/mapper/root` is an LVM partition.
  • Mount LVM:


    Ubuntu seems to always use LVM inside of LUKS, so this is how to setup the LVM layer once LUKS has been decrypted.

    apt install lvm2
    VOL_GRP=$(vgscan | tail -n 1 | cut -d '"' -f 2)
    vgchange -ay ${VOL_GRP}
    mkdir /mnt/root && mount /dev/${VOL_GRP}/root /mnt/root
Posted: | Source