Storage layers
A block device can contain partitions, a filesystem or LVM physical volumes. LVM builds volume groups and logical volumes; a filesystem then sits on a logical volume. Mounting attaches a filesystem to a directory. Mounting over a nonempty directory hides its existing contents until unmounted; it does not merge trees. EBS volume names shown in EC2 can differ from device names inside Linux, especially on NVMe instances. Identify by size, serial and metadata; never assume /dev/sdf is the new disk.
Discovery commands
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS,SERIAL
sudo blkid
findmnt
df -ThLab: a new empty EBS data volume
- Attach a disposable encrypted volume in the same AZ as your instance.
- Identify it with
lsblkand verify it contains no data or filesystem. - Only for that verified new device, create a filesystem using
sudo mkfs.ext4 /dev/DEVICE. - Create
/mnt/academy-dataand mount the device there. - Record its UUID using blkid. Back up
/etc/fstab, then add the entry below using the real UUID.
UUID=REPLACE_WITH_REAL_UUID /mnt/academy-data ext4 defaults,nofail 0 2- Run
sudo mount -aandfindmnt /mnt/academy-databefore testing a reboot. A malformed fstab can break boot; keep recovery access available.
Growing storage
Increase the EBS volume first, then extend the partition if one exists, and finally grow the filesystem. ext4 often uses resize2fs; XFS uses xfs_growfs on the mounted path. Device layouts determine the exact commands. A larger volume does not automatically enlarge the filesystem, and XFS cannot simply be shrunk.
Backup and swap
A snapshot captures block-level data; application-consistent backups may require database coordination. Test restoration onto a separate volume. Swap can cushion memory pressure but does not replace adequate RAM; avoid swapping secrets unencrypted and monitor latency. LVM snapshots also need space and are not independent disaster backups.
Assignment and cleanup
Save a marker file, snapshot the lab volume, restore it separately and read the marker. Unmount before detaching. Delete only the disposable volumes and snapshots you created.
Official reference
Ravindra’s Tip
Format command चलाने से पहले device पहचानना सबसे जरूरी है। नया disk और root disk confuse हुआ तो पूरा server खराब हो सकता है।
Interview and revision check
Why can df show the old size after enlarging EBS?
The block device grew, but a partition or filesystem may still need expansion. Inspect the actual layout before changing it.
Ravindra Bagale · Cloud & DevOps Academy · Handbook and project downloads