Skip to content

Instantly share code, notes, and snippets.

@reytech-dev
Created January 21, 2021 21:22
Show Gist options
  • Save reytech-dev/e3abc32f153c56b36e2d124d3e6ed25c to your computer and use it in GitHub Desktop.
Save reytech-dev/e3abc32f153c56b36e2d124d3e6ed25c to your computer and use it in GitHub Desktop.
Auto-mount LUKS partition

Mount an encrypted partition on boot

Hint: Always replace "< .... >" with the actual value

  1. Find out which name the partition has
$ lsblk
  1. Receive UUID of device
$ sudo cryptsetup luksUUID /dev/<result-of-lsblk-command> (e.g. sdb, sda etc.)
  1. Add new line to crypttab
$ sudo nano /etc/crypttab
=> New line: "<result-of-lsblk-command> /dev/disk/by-uuid/<result-of-uuid-coomand> none luks"
  1. Create directory where partition should get mounted
$ sudo mkdir /mnt/my_encrypted_partition
  1. Add new line to fstab
$ sudo nano /etc/fstab
=> New line: "/dev/mapper/<result-of-lsblk-command> /mnt/my_encrypted_partition ext4"
  1. Reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment