Disk encryption

From ArchWiki
Jump to navigation Jump to search
Note: This article is a work in progress. It's intended as a proposal for a new article, to be moved into the main wiki namespace after further discussion.

This article discusses common techniques available in Arch Linux for transparently encrypting / decrypting all data that is written to / read from a disk, or a logical part of a disk.

Why Use Encryption?

TODO: Merge intro section from "System Encryption with LUKS" here.

What Methods are Available for Disk Encryption?


Comparison Table

Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs


block device encryption stacked filesystem encryption

main selling points

longest-exiting one; possibly the fastest; works on legacy systems de-facto standard for block device encryption on Linux; very flexible very portable, well-polished, self-contained solution slightly faster than EncFS; individual encrypted files portable between systems easiest one to use; supports non-root administration

availability in Arch Linux

must manually compile custom kernel kernel modules: already shipped with default kernel; tools: device-mapper, cryptsetup [core] truecrypt [extra] kernel module: already shipped with default kernel; tools: ecryptfs-utilsAUR [AUR] encfs [community]


GPL GPL custom[1] GPL GPL
basic classification
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs


whole block device files

container for encrypted data may be...

  • a disk partition
  • a file acting as a virtual partition
  • a directory in an existing file system

relation to filesystem

operates below the filesystem layer - doesn't care whether the content of the encrypted block device is a filesystem, a partition table, a LVM setup, or anything else adds an additional layer to an existing filesystem, to automatically encrypt/decrypt files whenever they're written/read

encryption implemented in...

kernelspace kernelspace kernelspace kernelspace userspace
(using FUSE)

cryptographic metadata stored in...

? ? ? header of each encrypted file control file at the top level of each EncFs container

wrapped encryption key stored in...

? ? ? key file that can be stored anywhere control file at the top level of each EncFs container
practical implications
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

file metadata (number of files, dir structure, file sizes, permissions, mtimes, etc.) is encrypted

(file and dir names can be encrypted though)

can be used to encrypt whole hard drives (including partition tables)

can be used to encrypt swap space

no need to allocate a fixed amount of space in advance for the encrypted data container

can be used to protect existing filesystems without block device access, e.g. NFS or Samba shares, cloud storage, etc.


allows offline file-based backups of encrypted files

usability features
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

support for automounting on login

? ? ? ?

support for automatic unmounting in case of inactivity

? ? ? ?

non-root users can create/destroy containers for encrypted data

provides a GUI

security features
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

supported ciphers

AES ? ? AES, blowfish, twofish... ?

support for salting

(with LUKS)

support for chaining multiple ciphers

? ? ? ?

support for key-slot diffusion

(with LUKS)
? ? ?

protection against key scrubbing

? ? ? ?

support for multiple (independently revokable) keys for the same encrypted data

(with LUKS)
? ? ?
performance features
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

multithreading support

? ? ?

hardware-accelerated encryption support

? ? ?

optimised handling of sparse files

? ? ? ?
block device encryption specific
Loop-AES dm-crypt + LUKS Truecrypt

support for (manually) resizing the encrypted block device in-place

stacked filesystem encryption specific
eCryptfs EncFs

supported file systems

ext3, ext4, xfs (with caveats), jfs, nfs... ?

ability to encrypt filenames

ability to not encrypt filenames

compatibility & prevalence
Loop-AES dm-crypt + LUKS Truecrypt eCryptfs EncFs

supported Linux kernel versions

2.0 or newer ? ? ? 2.4 or newer
encrypted data can also be accessed from... Windows (with [3]) (with [4]) ? ?
Mac OS X ? ? ?     [5]
FreeBSD ? ? ?     [6]

used by

  • Arch Linux installer (system encryption)
  • Ubuntu alternate installer (system encryption)
  • Ubuntu installer (home dir encryption)
  • Chromium OS (encryption of cached user data[7])

Notes & References

  1. ^ see http://www.truecrypt.org/legal/license
  2. ^ well, a single file in those filesystems could be used as a container (virtual loop-back device!) but then one wouldn't actually be using the filesystem (and the features it provides) anymore
  3. ^ CrossCrypt - Open Source AES and TwoFish Linux compatible on the fly encryption for Windows XP and Windows 2000
  4. ^ FreeOTFE - supports Windows 2000 and later (for PC), and Windows Mobile 2003 and later (for PDA)
  5. ^ see EncFs build instructions for Mac
  6. ^ see http://www.freshports.org/sysutils/fusefs-encfs/
  7. ^ see http://www.chromium.org/chromium-os/chromiumos-design-docs/protecting-cached-user-data