Interview Prep/Linux/Storage, disks and filesystems

You need to encrypt a data disk on a Linux server holding customer data. How do you do it?

AdvancedScenarioStorage, disks and filesystems
Answer

Situation read → LUKS encryption at rest, with a plan for unlocking at boot.

What I'd do →

sudo cryptsetup luksFormat --type luks2 /dev/sdb
sudo cryptsetup open /dev/sdb securedata
sudo mkfs.xfs /dev/mapper/securedata
  1. Add to /etc/crypttab: securedata UUID=<luks-uuid> none luks and mount via fstab.
  2. For unattended boot, bind to TPM2 (systemd-cryptenroll --tpm2-device=auto /dev/sdb) or network-bound Clevis/Tang.
  3. Back up the LUKS header: cryptsetup luksHeaderBackup /dev/sdb --header-backup-file hdr.img.

Why → If the header is lost, the data is gone forever; TPM/Tang avoids a human typing a passphrase.

Interview tip → In the cloud, mention provider-managed encryption (EBS + KMS) as usually enough unless policy requires OS-level keys.

All Linux questions Roadmap: Linux

More on Storage, disks and filesystems