RBCloud & DevOpsTHE PRACTICAL LEARNING LIBRARY
By Ravindra BagaleResources

CHAPTER 11 / 60

Disks, mounts, swap, LVM and backups

Understand persistence before formatting or mounting any device.

Concept + practical labBy Ravindra Bagale · ~5 min read · lab time additional

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

bash
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS,SERIAL
sudo blkid
findmnt
df -Th

Lab: a new empty EBS data volume

  1. Attach a disposable encrypted volume in the same AZ as your instance.
  2. Identify it with lsblk and verify it contains no data or filesystem.
  3. Only for that verified new device, create a filesystem using sudo mkfs.ext4 /dev/DEVICE.
  4. Create /mnt/academy-data and mount the device there.
  5. Record its UUID using blkid. Back up /etc/fstab, then add the entry below using the real UUID.
text
UUID=REPLACE_WITH_REAL_UUID /mnt/academy-data ext4 defaults,nofail 0 2
  1. Run sudo mount -a and findmnt /mnt/academy-data before 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

Extend an EBS filesystem

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