Encrypt a disk on Ubuntu
Identify Disk such as /dev/sdb
lsblk
Install Necessary Tools
sudo apt update
sudo apt install cryptsetup
Encrypt the Disk
sudo cryptsetup luksFormat /dev/sdb
- Type
YES
to confirm. - Enter and confirm a passphrase.
Open the Encrypted Disk:
sudo cryptsetup open /dev/sdb encrypted_disk
This maps the encrypted disk to /dev/mapper/encrypted_disk
Format the Encrypted Volume:
sudo mkfs.ext4 /dev/mapper/encrypted_disk
Mount the Encrypted Disk: Create a mount point and mount the disk:
sudo mkdir /mnt/encrypted
sudo mount /dev/mapper/encrypted_disk /mnt/encrypted