How To Encrypt Disk In Linux Securely

Last updated: August 9, 2023 Reading time: 7 minutes
VPN Linux

Encryption has become a mainstream term as a solution to many privacy risks. Privacy advocates and security analysts are extensively recommending it to all individuals regardless of the risk intensity they are prone to. Similarly, encrypting a device could help you in many ways, including data safety in case of device theft. Fortunately, individuals with Linux devices have the best way out Linux disk encryption.

Encryption is a method to secure your data by converting them into an unreadable form protected by an encryption key, accessible only by entering the encryption key. It evades the threats and perils of hacking, malicious intrusions, and irritating siblings, and above all, it shields your identity in case your Linux laptop or PC is lost.

What is disk Encryption?

Disk encryption is a method for absolute storage device protection instead of security implementations on electronic files individually. It is an extraordinarily helpful method for a device that ensures that your data is stored in an unreadable coded form. Access to encrypted data is only possible for an authorized person with an accurate encryption key.

Therefore, all the files and folders, and disk volume are secured through encryption and can only be decrypted when required by the authorized user with the key. There are many advantages of full disk encryption that we have discussed below.

Merits of Disk Encryption

Disk encryption isn’t an unknown term for most people nowadays. Also, many devices now have the default encrypting feature to protect your data stored on the disk. Disk encryption has some potential advantages:

  • Disk encryption prevents unauthorized access to data when the PC is located where untrustworthy people can access it, if your PC gets stolen, at the computer repair shop, or when you discard it.
  • Whole disk encryption ensures the protection of all the files, folders, and temporary files. Hence each and everything is encrypted on the disk.
  • Full Disk encryption covers every file and folder, so there is no chance of anything being left behind; this is more secure than encrypting individual files and folders where you can leave something important unencrypted by chance.

Demerits of Disk Encryption

  • Disk encryption only protects you against untrustworthy people who can have physical access to your computer. It cannot save you from cyber attacks, and your computer is still vulnerable to getting attacked by a hacker who could access your device through malware installation.
  • Malicious apps and websites can still pop up, and your system might get infected with the viruses or worms they contain.
  • Network hackers and attackers can still exploit services running on your devices, such as network file sharing, BitTorrent client, or your iTunes playlist sharing, to name a few.
  • Government and security surveillance agencies can still spy on your internet activities, and all your internet information is still accessible.

Therefore, make sure you use some additional internet security software, such as VPNs, to get safe and secure internet access because disk encryption can only evade the physical access threat of your computer; the potential cyber threat is still there, as mentioned above.

Process of disk Encryption in Linux

The method of Linux disk encryption is categorized into two, according to the layer of operations;

1. Stacked Filesystem Encryption

Stacked filesystem encryption solutions are applied as a layer that stacks on top of an existing filesystem. This makes all files written to an encryption-enabled folder be encrypted instantly before the underlying filesystem writes them to disk and decrypts it whenever the filesystem reads them from disk.

Through this method, the files are stored in the host filesystem in an encrypted form (which means that their contents and file/folder names are replaced by random-looking data of roughly the same length). However, other than that, they are present in that filesystem as they would without encryption, as normal files.

2. Block Device Encryption

On the other hand, the Block device encryption method operates below the filesystem layer. It ensures that everything written to a specific block device (i.e., a whole disk, a partition, or a file acting as a virtual loopback device) is encrypted. It means that while the block device is offline, its whole data looks like a large block of random data without any way of recognizing what kind of filesystem and data it contains.

Access to this data is only possible again by mounting the protected container (where the encrypted data is stored and, in this case, the block device) to an arbitrary location in a special way.

Linux disk Encryption Software

Much third-party software is available for Linux disk encryption that can help you encrypt the whole disk and decrypt them when required. This could be done by performing some simple downloading and installation steps; the top Disk Encryption software for Linux is:

1. ECryptfs

eCryptfs provides an actual stacked Linux disk encryption file system. The encryption by eCryptfs is stacked on an existing filesystem, mounts onto any single existing directory, and does not need a separate partition.

2. EncFS

EncFS is a straightforward and user-friendly software for Linux disk encryption. It is a userspace stackable cryptographic filesystem similar to eCryptfs, which aims to secure data with absolutely no fuss and hassle. It uses a FUSE mechanism to mount an encrypted directory on another directory mentioned by the user, and It does not require a loopback system like some comparable systems.

3. Loop-AES

loop-AES is a speedy, secure solution to Linux disk encryption; it is a descendant of the crypto loop but is considered less user-friendly than the other possible option because it needs non-standard kernel support.

4. Dm-Crypt

Device-mapper crypt (Dm-crypt) offers a generic way to make virtual layers of block devices. Device-mapper crypt target offers explicit encryption of block devices, and it uses the kernel crypto API. The user of dm-crypt can specify one of the symmetric encryption, a key (of any allowed size), an iv generation mode, and the user can create a new block device in /dev writes to the device are encrypted and reads decrypted.

5. TrueCrypt

TrueCrypt is a free, open-source, on-the-fly Linux disk encryption (OTFE) program. It virtually encrypts the disks within files that can be mounted as actual disks. It can encrypt an entire hard drive partition or a storage device. It is considered the most secure form of Linux disk encryption so far. However, Truecrypt ended its development in May 2014, and no updates, fixes, or further versions are available; the alternate and successor of TrueCrypt are VeraCrypt.

Steps Of Disk Encryption In Ubuntu (Using Ubuntu’s Built-In Disk Encryption Feature)

In Ubuntu, you can encrypt the whole drive, as it offers you the option while downloading and installing it on your PC. So, if you are already running it, you need to backup your data and reinstall it, and while doing so, we are going to tell you how you can encrypt the whole drive by the following steps:

1. Insert the Ubuntu installation CD or USB, start the booting, and follow the instructions; when you are at the “Installation type” page, check the box “Encrypt the new Ubuntu installation for security,” and then click Install Now.

linux disk encryption

2. Now go to the next page, “Choose a security key,” and enter your encryption key; that must be a complex phrase that is almost impossible to guess by anyone trying to access your PC.

  1. When you are done typing the confirming the security key, click install now and follow the rest of the instructions. Moreover, when you are on the‘’ Who are you?’’ page, enter your details and choose a strong, unbreakable password. Check the box which says, ‘’Require my password to log in’’ and never check ‘’Login Automatically’’ and leave the box which says, “Encrypt my home folder” unchecked because you do not need it.
linux disk encryption
  1. Now continue to finish the installation process. Here you are, you are now running a secure and encrypted Linux PC, and no one can hamper your data with physical access, and only you and the authorized people who know the password can access the PC.


Encryption is a necessary protective measure that every individual must implement. It is a valuable feature for every person as it is never assured that your device will remain with you always. In case of a loss, theft, or access by a malicious person, your personal information could be in danger, as most of us keep sensitive and private data safe on our laptops.

But it is also essential to know the suitable method to follow and the consequences of not encrypting your device; now you know what would happen to your data if it is naked to every eye that gains access to your PC. So, be safe and encrypted!

Share this article

About the Author

Waqas is a cybersecurity journalist and writer who has a knack for writing technology and online privacy-focused articles. He strives to help achieve a secure online environment and is skilled in writing topics related to cybersecurity, AI, DevOps, Cloud security, and a lot more. As seen in:, Nordic APIs,,, and VentureBeat.

More from Iam Waqas

Related Posts