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
- Add to
/etc/crypttab:securedata UUID=<luks-uuid> none luksand mount via fstab. - For unattended boot, bind to TPM2 (
systemd-cryptenroll --tpm2-device=auto /dev/sdb) or network-bound Clevis/Tang. - 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.
More on Storage, disks and filesystems
You get paged at 3 AM: the root filesystem on a production server is at 98% and climbing. Walk through your response.BeginnerA new 200 GB EBS volume is attached to an EC2 instance. How do you make it usable and persistent across reboots?BeginnerThe `/var` LVM logical volume is nearly full and there is free space in the volume group. How do you grow it online?BeginnerThe volume group has no free space. You've been given a new disk. How do you add it to grow `/var`?IntermediateA cloud VM's root disk was enlarged from 30 GB to 80 GB in the console, but `df` still shows 30 GB. What do you do?BeginnerYou need to move a busy MySQL data directory from the root disk to a new, faster volume. Plan it.Intermediate