Interview Prep/Linux/Storage, disks and filesystems

A new 200 GB EBS volume is attached to an EC2 instance. How do you make it usable and persistent across reboots?

BeginnerScenarioStorage, disks and filesystems
Answer

Situation read → Partition (optional), format, mount, fstab by UUID.

What I'd do →

lsblk                                  # find it, e.g. /dev/nvme1n1
sudo mkfs.xfs /dev/nvme1n1
sudo mkdir -p /data
sudo blkid /dev/nvme1n1                # copy the UUID
echo 'UUID=<uuid> /data xfs defaults,nofail 0 2' | sudo tee -a /etc/fstab
sudo mount -a && df -h /data

Why → Device names like /dev/nvme1n1 can change between boots; UUIDs don't. nofail keeps the instance booting if the volume is detached.

Interview tip → Always run mount -a after editing fstab, before rebooting, to catch mistakes.

All Linux questions Roadmap: Linux

More on Storage, disks and filesystems