I have been given a task to creat a LUKS encrypted partition and then mount it, here are the steps I followed:
Create the partition for encryption:
sudo fdisk /dev/sda
Reboot
Format the partition with cryptsetup:
sudo cryptsetup luksFormat /dev/sda3
Open encrypted partition:
sudo cryptsetup luksOpen /dev/sda3 secret-disk
Add the following to
/etc/crypttab
:secret-disk /dev/sda3
Make filesystem on partition:
sudo mkfs -t ext3 /dev/mapper/secret-disk
Make mount directory:
sudo mkdir /secret
Add the following to
/etc/fstab
:/dev/mapper/secret-disk /secret ext4 defaults 1 2
Mount partition at /secret:
sudo mount /secret OR sudo mount -a
Reboot.
Problem: During reboot, the mount instruction in fstab
returns the error : device not ready or not present
. And I have to enter S
to skip the mount so ubuntu can boot or M
to recover it manually. I have checked this option but it does not solve mine. How do I get the encrypted partition to mount at /secret
.
The solution was to add this
secret-disk /dev/sda3 none luks
to the/etc/crypttab
file as admin and reboot. The passphrase will be requested, and the encrypted partition unlocked.