Home » today » Technology » How to encrypt a hard drive with Linux

How to encrypt a hard drive with Linux

But at the same time it poses a problem Try to recover the data in case Forget the access code, otherwise the hard disk will start crashing until it reaches the point where it becomes inaccessible. The hard disk encryption can only be unlocked from the computer.

If the hard drive stops working and we try to recover data using third-party applications, we hit an unaffordable wall. The solution to this problem is to use a cloud storage platform, which allows us to instantly sync all the files we create or modify, and avoids the need to make backups, although this is another option.

But unless you get into the habit of backing up on a regular basis (something very few users do), they are of little use if your hard drive suddenly stops working.

On older computers, encryption of the hard disk is the same Performance issues, problems that always appear in the long run as the number of saved files increases. On newer computers, Linux encryption does not affect system performance.

During installation

Of Best method To properly encrypt a Linux hard drive, this process is performed during installation, so the first thing we need to do is make a backup copy of all the files we want to keep so that we can copy them back after the installation is complete.

Then we download the version of Linux we are going to install, create an installation medium (USB, DVD, CD…), start our computer to perform the installation and modify the BIOS. The system starts with the installer. When starting up the system, we choose Try installing Ubuntu.

You start the computer, on the welcome screen we select Spanish and click on the Install Ubuntu button. The next option invites us to select the language for the distribution we are going to install along with the keyboard layout.

Linux keyboard layout

In the next window, the distribution invites us to select the type of installation required: Usual (with all accessories) or MinimumWith basic and necessary applications to work properly.

Linux installation typeLinux installation type

Now we need to select the drive where we want to install the Linux distro. If we have a hard drive and we are going to install it and do not plan to create partitions, we delete the drive, install Ubuntu and then install advanced features.

In Advanced Features, select Use LVM in Ubuntu installation and check the box Encrypt Ubuntu installation for security.

Encrypt the Linux installationEncrypt the Linux installation

Next, we must Enter the security key This will unlock the encryption on our device. It is recommended to check the Enable recovery key, which will be stored on your computer and let us know the encryption password we used.

Encrypt Linux hard driveEncrypt Linux hard drive

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

Create a new encrypted partition

If the idea of ​​reinstalling Linux does not strike you, a quick and easy solution is to create a new partition from your computer, which we will encrypt at the time of formatting.

Encrypting a Linux partition means losing all the content we have stored in it, so the first thing we need to do is create a secure backup.

We will use it to create an encrypted partition on Linux Disk Utility is included in the system. When you open the program, all the drives on your computer will appear on the left side.

We select the drive we want to create a partition, click on the gear at the bottom and select the Format partition option.

Encrypts Linux partitionEncrypts Linux partition

Then we introduce a name for the partition so that it can be recognized, and in the Type section we indicate that Linux systems (Ext4) and internal disk enclosures should only use it. Password protected module lux.

Encrypts Linux partitionEncrypts Linux partition

When we click Next, the application will invite us to create a password that protects access to that partition and click the Next button.

Password Encryption LinuxPassword Encryption Linux

If we try to access that partition, the system will ask us to enter the password if we want to access the data.

Access an encrypted Linux partitionAccess an encrypted Linux partition

From the command line with Luxury

Another option in Linux for encrypting partitions and hard drives in Linux is to use the command line. The process is through the disk tool of the graphical distribution we installed, but writes all commands from the terminal.

Lux is a widely used tool for encrypting Linux hard drives from the command line Available in most Linux distributions So there is no need to download additional software.

If you have not previously encrypted any other system partition with the disk application or during installation, the first thing we need to do is mount it on our system with the command:

sudo apt install crypsetup

Then you need to create a new partition on your computer, which will be encrypted during the Lux formatting process. To use an existing partition, you must first delete it and recreate it.

To format a new partition with Lux, type the following command

sudo cryptsetup luksFormat /dev/sda1

If the partition we are going to format does not match the main hard disk (in this case sda1), we need to make it equal.

Confirm the process by typing yes and then We enter the password We want to use it to encrypt the new partition we created.

Once the process is complete, each time we want to access the encrypted partition or drive, we need to enter the password we enter.

Other programs for encrypting a hard disk in Linux

Besides Lux, you can use other programs to encrypt Linux hard drives or partitions. However, they are not available, so we are forced to download them.

VeraCrypt

VeraCrypt requires its own application Access encrypted partitions. This is a difficulty that does not exist in Lux, as it is integrated into Ubuntu, Debian and many other Linuxs.

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

AES Crypto

With AES Crypt, we can not encrypt partitions using AES encryption, but we can Encrypts files freely. Of course, accessing the content requires the use of the app, just like Vera Crypt.

AES Crypt is available in 32-bit and 64-bit versions for both the Linux GUI and command line. It is also available for Windows, Android, macOS, OS X and iOS / iPadOS. You can download this software from the website by clicking below A link to your site.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.