Ubuntu · Filesystem & permissions

Encrypt the disks holding the system and data

When it fails: File systems or swap are stored unencrypted on disk. Anyone holding the disk or the device, lost, stolen or discarded, can read its data and change the system offline.

CB-UBU-FS-012mediumactiveautomatedprofile desktop-hardened

Description

With LUKS (dm-crypt), each partition or LVM volume group is encrypted with a key unlocked at boot, by a passphrase, a TPM or a key server. The Ubuntu installers set it up when asked: the desktop installer with its LVM and encryption option (or, from 23.10, the experimental TPM-backed encryption), the server installer by encrypting the LVM volume group in the guided storage layout. Only /boot and the EFI system partition stay in clear text.

The check covers every mounted ext2/3/4, XFS, Btrfs, F2FS and JFS file system except /boot and below, and every swap partition or swap file; zram swap is in memory and skipped. A device that is not a block device (ZFS dataset, network file system) makes the check report an error, to be reviewed by hand.

Ubuntu desktops swap to /swap.img on the root file system, which is therefore encrypted with it. TPM-backed encryption also uses LUKS2 volumes, so the check accepts it the same way.

Rationale

Laptops and workstations are lost and stolen, and disks leave with returned or discarded hardware. Without encryption, the data, the password hashes and the keys on the disk can be read, and the system can be modified offline (for example to plant a backdoor) without any trace.

Impact

A passphrase must be typed at every boot, unless a TPM or network unlock is set up, which makes unattended reboots harder. Encrypting an existing system requires a reinstallation or an offline conversion. Performance cost is negligible on CPUs with AES instructions.

Setting

LocationDisk layout, /etc/crypttab
DefaultUnencrypted unless chosen in the installer
RecommendedEvery file system except /boot, and swap, on a dm-crypt device

Audit

Run lsblk -o NAME,TYPE,FSTYPE,MOUNTPOINTS. Every mounted file system except /boot and /boot/efi, and every swap, must sit below a device of type crypt.

Automated: every check must pass. Scanners report each check by its id.

crypt

dm-crypt below each mounted disk file system and swap.

script: |
  rc=0 n=0
  list=$(findmnt -rn -o SOURCE,TARGET -t ext2,ext3,ext4,xfs,btrfs,f2fs,jfs
         swapon --noheadings --show=NAME,TYPE 2>/dev/null | while read -r name type; do
           case $type in
             partition) echo "$name swap" ;;
             file) echo "$(findmnt -n -o SOURCE -T "$name") swap:$name" ;;
           esac
         done)
  while read -r src target; do
    [ -n "$src" ] || continue
    case $target in /boot | /boot/*) continue ;; esac
    case $src in /dev/zram*) continue ;; esac
    dev=${src%%\[*}
    n=$((n + 1))
    if ! t=$(lsblk -nso TYPE "$dev" 2>/dev/null); then
      echo "$target on $src: not a block device, check by hand"
      [ "$rc" = 1 ] || rc=3
    elif ! printf '%s\n' "$t" | grep -qx crypt; then
      echo "$target on $src: not encrypted"
      rc=1
    fi
  done <<EOF
  $list
  EOF
  [ "$rc" = 0 ] && echo "$n file systems and swaps, all on dm-crypt"
  exit "$rc"

Remediation

Encryption cannot be added safely to a running system by a script.

  1. For a new system, enable encryption in the Ubuntu installer (desktop: LVM and encryption, or TPM-backed encryption; server: encrypt the LVM volume group), set storage with a password in an autoinstall file, or create LUKS2 volumes with cryptsetup luksFormat and list them in /etc/crypttab.
  2. For an existing system, back up the data, reinstall with encryption and restore; or convert offline with cryptsetup reencrypt --encrypt from a live system, after a full backup.
  3. Encrypt swap as well (inside the encrypted LVM, or with a random key in /etc/crypttab).
  4. Keep a recovery passphrase in a safe place, separate from the device.

References

Mappings

FrameworkIDRelation
NIST SP 800-53 Rev. 55.1.1SC-28(1)equivalent
NIST SP 800-53 Rev. 55.1.1MP-5related

How this control relates to the other framework's: equivalent, stricter, looser, partial or related.

Threats mitigated

People and lifecycle

Authors
Verified2026-10-19 by Sn0wAlice on 20.04, Proxmox VM 2520, Ubuntu 20.04 cloud image, kernel 5.4.0-216-generic. Fails on the unencrypted cloud root (expected, manual fix); a LUKS2 loop device mounted ext4 is accepted.
Verified2026-10-19 by Sn0wAlice on 22.04, Proxmox VM 2522, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic. Fails on the unencrypted cloud root (expected, manual fix); a LUKS2 loop device mounted ext4 is accepted.
Verified2026-10-19 by Sn0wAlice on 24.04, Proxmox VM 2524, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic. Fails on the unencrypted cloud root (expected, manual fix); a LUKS2 loop device mounted ext4 is accepted.
Verified2026-10-19 by Sn0wAlice on 26.04, Proxmox VM 2526, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic. Fails on the unencrypted cloud root (expected, manual fix); a LUKS2 loop device mounted ext4 is accepted.
Introduced inv0.1.0
Created, updated2026-10-19, 2026-10-19
Translationsfr