How to manually encrypt a second hard drive in Ubuntu 20.04
Last modified on July 24, 2026 • 1 min read • 186 words
You have added a second hard drive to your encrypted Linux system. The Debian installer makes it easy to encrypt during system installation, but how do you encrypt this new drive?
https://dev-notes.eu/2020/12/LUKS-Encrypt-Hard-Drive-with-Cryptsetup-on-Ubuntu-20.04/Check disks:lsblksudo hdparm -i /dev/sdaUse parted (for disks smalle rthan 2TB fdisk can be used instead of parted):sudo parted /dev/sda mklabel gptsudo parted -a opt /dev/sda mkpart primary ext4 0% 100%Make LUKS encryption. Here you need to type in the passphrase you will use to decrypt the disk:cryptsetup -y -v luksFormat /dev/sda1Create temporary mapping:sudo cryptsetup luksOpen /dev/sda1 DOCUMENTS (if you don’t get any error, you succeeded)Check mapping:ls -l /dev/mapper/DOCUMENTSsudo cryptsetup -v status DOCUMENTSMake mapping persistent. Instead of “none”, you can also specify a keyfile (= much less secure if this file is on the same system). Instead of /dev/sda1 you can also give the UUID. Maybe it is also not necessary to have a partition and /dev/sda might be used directly. You can find out about the UUID with “blkid” or - if that doesn’t work - with “ls -l /dev/disk/by-uuid"DOCUMENTS UUID=e6813be6-1e6e-4c6f-80cf-b47a428a700d none luks,discardCheck LUKS header:sudo cryptsetup luksDump /dev/sda1Make file system:sudo mkfs.ext4 /dev/mapper/DOCUMENTS -L “4TB_DOCUMENTS_DISK”