0%

Disk Encryption

Learn how to encrypt your hard-drive partitions using LUKS encryption method, providing secure data protection for Linux systems.

Given below is a method of encrypting your hard-drive partition (SSD/HDD) using luks encryption method, But this file system can only be recognised in a Linux Box and thus can only be decrypted in Linux. As the partition format is unrecognized in windows filesystem.

Formatting the Partition

Here we are formatting the partition in LUKS (Linux Unified Key Setup)

Here we use luksFormat to create a encryption layer. On the partition. By doing so the partition will be completed formated so make sure it is a empty partition.

$ cryptsetup luksFormat /dev/sdxY

Here x is a alphabet, and Y is a number, which reperesent the block file for the Yth partition of disk x.


Initialise LUKS devices

Here we use the luksOpen which temporarily disables the encryption layer.

This devices will then be available in /dev/mapper/

here is a arbitrary value used to identify the block file.

$ cryptsetup luksOpen /dev/sdxY <name>

Format this decrypted device

As luks acts as an encrypted wrapper over the underlying partition. we can use any mkfs cmd to format it. We can then normally mount it. This is done only after unlocking the encryption layer.


Mounting the Device

Sometimes connecting the device with a encrypted partition, automatically provokes a initialising and mounting procedure and prompts you to enter your password, in some Linux operating systems.

The device can be mounted simply using the mount command

$ mount /dev/mapper/<name> <mountpoint>

Re-Encrypt the partition

Here the drive must be unmounted first, then perform a re-encryption using:

$ cryptsetup luksClose /dev/mapper/<name>

Changing the Password of the partition

This requires you to know the old password given to the partition.

$ cryptsetup luksChangeKey /dev/sdxY