How to encrypt a hard disk with Linux

But, at the same time, it poses a problem when To try to recover data in case Forgetting the password or the hard drive starts crashing until it reaches a point where we can no longer access it. The hard drive can only be decrypted from the system itself.

If the hard drive stops working and we try to recover the data using third-party applications, we will be faced with an insurmountable wall. The solution to this problem is to use a cloud storage platform that allows us to instantly synchronize all the files that we create or modify, thus avoiding the need to make backups, although this is another option.

However, unless you are in the habit of backing up on a regular basis (something very few users do), it will be of little use if your hard drive suddenly stops working.

On older computers, hard drive encryption is synonymous with performance problems, problems always appear in the long run, as the number of stored files increases. On newer computers, Linux encryption does not affect computer performance.

during installation

The The best way To properly encrypt a Linux hard disk, this process is performed during installation, so the first thing we must do is back up all the files that we want to keep for copying again once the installation is complete.

Next, we proceed to download the version of Linux that we will install, create an installation medium (USB, DVD, CD …) with which we will start our computer to perform the installation and modify the BIOS so that the computer starts with the installer. When the computer starts, we choose Try or install Ubuntu.

One has started the system, in the welcome screen we select Spanish and click on the Install Ubuntu button. The next option invites us to select the language of the distribution that we will install along with the keyboard layout.

See also  Darby McDevitt will continue to work on the franchise

Linux keyboard layout

In the next window, the distribution invites us to select the type of installation we want: Normal (with all accessories) or minimumwith basic and necessary applications to function properly.

Linux installation type

Now we must select the module in which we want to install the Linux distro. If we have a hard disk where we are going to install and we don’t plan to create partitions, we choose Erase disk and install Ubuntu and then Advanced Features.

Under the advanced functions, we choose Use LVM in an Ubuntu installation and check the box Ubuntu installation encryption for security.

Linux installation encryption

Then, we must Type the security key Which will unlock the encryption on our devices. It is recommended to check the Activate recovery key box, which is a key that will be stored in the system and will allow us to find out the encryption password we used.

Linux hard drive encryption

Finally, click on Install and wait for the process to finish. Once we are done and running the version of Ubuntu that we installed for the first time, before loading the graphical interface, it will ask us for the encryption key.

Create a new encrypted partition

If the idea of ‚Äč‚Äčreinstalling Linux has not occurred to you, the quickest and easiest solution is to create a new partition from the system, one that we will encrypt at the time it is formatted.

Encrypting a Linux partition is associated with the loss of all the content we have stored inside it, so the first thing we must do is make a secure backup.

To create an encrypted partition in Linux, we will use a file System Disk Application. When you open the application, all available drives on your computer will be displayed in the left section.

See also  How to protect WhatsApp chats saved in Google Drive or Apple iCloud

We select the drive where we want to create the partition, at the bottom we press the gear wheel to select the Format partition option.

Linux partition encryption

Next, we provide a name for the partition so that we can identify it and in the Type section we tick the boxes for the internal disk for use only with Linux (Ext4) systems and Password protected Luks volume.

Linux partition encryption

When you click Next, the application will invite us to create a password that protects access to this section and click the Next button.

linux password encryption

If we try to access this section, the system will invite us to enter the password if we want to access the data.

Access to the encrypted Linux partition

From the command line with Luks

Another option available in Linux for encrypting partitions and hard drives in Linux is to use the command line. The process is the same with the Discos fee distribution app we have installed, but typing all the commands from the terminal.

Luks is the most used tool for encrypting Linux hard drives from the command line since it was found Available in most Linux distributions So there is no need to download additional software.

If you have not previously encrypted any other system partition using the Disk application or during the installation process, the first thing we must do is install it on our computer using the command:

sudo apt install crypsetup

Next, a new partition must be created on the computer, one that will be encrypted in the process of formatting with Luks. If you want to use an existing partition, you must first delete and recreate it.

See also  Google Photos updated: Now users can watch a movie about their lives

To format the new partition with Luks, we must type the following command

sudo cryptsetup luksFormat /dev/sda1

If the partition we are going to format does not correspond to the main hard drive (in this case sda1), it must be replaced with the corresponding partition.

We must confirm the operation by typing YES and Enter the password which we want to use to encrypt the new partition we created.

Once the process is finished, every time we want to access the encrypted partition or drive, it will be necessary to enter the password we created.

Other Linux hard disk encryption software

In addition to Luks, we can also use other software to encrypt Linux hard drives or partitions. However, it is not available originally, so we will have to download it.


VeraCrypt requires its own app to be able to do this Access to encrypted partitions. This is an annoyance that we won’t find in Luks because it is built into most Linux systems like Ubuntu, Debian, and others.

This app is available for Ubuntu, Debian, CentOS, and OpenSUSE as well as for Windows, macOS, Raspberry Pi, and FreeBSD. You can download VeraCrypt through the following Link.

AES encryption

With AES Crypt, we can not only encrypt partitions with AES encryption, but we can also Encrypt files independently. Of course, to be able to access its content, as with Vera Crypt, it is necessary to use the application.

AES Crypt is available for both Linux GUI and command line, in 32-bit and 64-bit versions. Moreover, it is also available for Windows, Android, macOS, OS X, and iOS/iPadOS. You can download this software from their website by clicking on the following Link to your website.

Lovell Loxley

"Alcohol buff. Troublemaker. Introvert. Student. Social media lover. Web ninja. Bacon fan. Reader."

Leave a Reply

Your email address will not be published.

Back to top