Chapter 13: Amazon EBS (Elastic Block Store)
13.1 What and why
Friends, sooner or later every server runs out of disk space — usually at the worst possible time. This chapter teaches you how to handle storage calmly. Mauli Dairy's orders data is also growing every day. Let's first understand what EBS is.
मित्रांनो, कधी ना कधी प्रत्येक सर्व्हरची डिस्क स्पेस संपते — आणि ते पण नेमक्या चुकीच्या वेळी. हा चॅप्टर स्टोरेज शांतपणे कसं सांभाळायचं ते शिकवतो. Mauli Dairy च्या ऑर्डर्सचा डेटा पण रोज वाढतोय. आधी EBS म्हणजे काय ते समजून घेऊया.
दोस्तों, कभी न कभी हर सर्वर की डिस्क स्पेस ख़त्म होती है — और वो भी ठीक गलत समय पर. ये चैप्टर सिखाता है कि स्टोरेज को शांति से कैसे संभालें. Mauli Dairy के ऑर्डर्स का डेटा भी रोज़ बढ़ रहा है. पहले समझते हैं कि EBS क्या है.
Amazon EBS provides block-level storage volumes — virtual hard disks — that you attach to EC2 instances. An EBS-backed AMI launches with an EBS root volume. The AMI and launch configuration determine the root storage.
Why EBS?
- Persistent: attached EBS data survives a normal stop and start. Instance store data is lost on stop. Termination follows each EBS volume’s delete-on-termination setting.
- Flexible: on supported volumes and instance types, you can increase size, change type or adjust performance while the volume is in use. Check whether the guest storage layers need to be extended afterward.
- Durable: automatically replicated within its Availability Zone.
- Backups: create point-in-time snapshots independently. AWS stores them in service-managed S3, and you manage them through EBS rather than an ordinary S3 bucket.
- Encryption: encrypted volumes use AWS KMS and protect stored blocks and the transfer between EC2 and the volume. Snapshots of encrypted volumes inherit encryption. Plan the approved KMS key and permissions.
Availability Zone ap-south-1a
+------------------------------------------------------------+
| EC2 instance |
| ├── /dev/nvme0n1 (root EBS, gp3 8 GiB) → / |
| └── /dev/nvme1n1 (data EBS, gp3 20 GiB) → /data |
+------------------------------------------------------------+
│ snapshot (incremental)
▼
EBS Snapshots (regional, stored in S3) ──► create new volume in ANY AZ of the region
Key rules
- An EBS volume lives in one Availability Zone and can only attach to instances in the same AZ. To recover into another AZ in the Region, create a new volume there from a completed snapshot. For another Region, make the appropriate snapshot copy first.
- Normally one volume attaches to one instance. Supported io1 and io2 Multi-Attach configurations require compatible instances in the same AZ and coordinated handling of shared writes.
- Provisioned volume size and applicable performance settings can incur charges even when the disk is empty or the instance is stopped. Retained snapshots have their own storage charges.
Ravindra Bagale's Tip
Many students create the volume in one AZ while the instance is in another – then the volume never shows up in the attach list. Check the instance's Availability zone before creating a volume. And remember: even an empty disk is billed for its provisioned size.
Ravindra Bagale's Tip – मराठी
खूप students volume एका AZ मध्ये बनवतात आणि instance दुसऱ्या AZ मध्ये असतो – मग attach list मध्ये volume दिसतच नाही. Volume बनवण्याआधी instance चा Availability zone बघा. आणि लक्षात ठेवा: रिकाम्या disk ला पण provisioned size प्रमाणे पैसे लागतात.
Ravindra Bagale's Tip – हिंदी
बहुत students volume एक AZ में बनाते हैं और instance दूसरे AZ में होता है – फिर attach list में volume दिखता ही नहीं. Volume बनाने से पहले instance का Availability zone देखो. और याद रखो: खाली disk के भी provisioned size के हिसाब से पैसे लगते हैं.
Lab
For an already assigned instance, use read-only inventory to note the root volume’s type, size, AZ and delete-on-termination setting. Otherwise use the synthetic inventory and local persistence lab below.
Keep Mauli Dairy’s order history when the server changes
At the end of a day, Mauli Dairy's order system has received orders from regular customers and updated delivery totals. Their sales app runs on an EC2 instance. A trainer can stop the app and start it again from its original code. The orders entered since the last day must still be there. This leads to two different requirements. The processor and memory need to be available while the app runs. The storage needs to keep the files that contain the data when the process exits and, under the chosen lifecycle policy, when the machine itself changes.
Amazon Elastic Block Store supplies block storage volumes you can attach to supported EC2 instances. A volume is presented to the operating system as a storage device capable of reading and writing parts of a disk-like address space. The operating system or application chooses how to organize those bytes. Most learners will see a filesystem on top, with paths such as /var/lib/dairy/orders.db. The volume gives those files storage with a lifecycle of its own. It cannot tell what an order means or decide which part of a database operation was finished. Application behavior, filesystem organization and the AWS volume sit at different layers.
Think of a running machine with its data volume attached. One person sees the EC2 instance, volume ID and Availability Zone in AWS. Another uses the operating system's disk tools and sees a device, filesystem and directory. A third opens the app and reads the intended order. These are three perspectives on the same requirement. A volume can appear in AWS as attached even while the directory needed by the app has not been mounted. A valid mount can still hold the wrong order book. A service that answers a browser request can still be writing its data on the wrong device. Bring the three observations together before declaring the storage ready.
The dairy uses a root volume for its OS and files that belong to the deployed service. It is considering a separate volume for the order database and related data that must be restored with it. Separating them can help make ownership, restore scope and growth clearer. It is a design decision, not a durability guarantee. A second volume in the same AZ shares that AZ scope, and each volume can still be wrongly configured, attached or deleted. The store also needs a recovery procedure that can produce a usable order history from an earlier point.
Follow a saved order from a named file to block storage
A shopper orders two bottles. The web app accepts the information and passes it to its database code. The database changes the structures it uses to store records and may write a journal or transaction log, depending on the engine. The kernel translates file activity through the filesystem's allocation and metadata. The storage device carries reads and writes to blocks at addresses. There is no separate object in EBS named after that shopper's order. Individual orders are structures interpreted by the application and database within stored data.
A filesystem gives a block device an organization the OS can understand, including directory entries, file contents and ownership metadata. Some designs divide a disk into partitions and put a filesystem inside one partition. Other designs use a filesystem on an entire device or place additional logical layers between device and filesystem. A mount point is where the OS places the accessible filesystem in its directory tree. A directory's name alone does not prove which device stores the files written below it. The path record and actual mounted-source record should agree.
Suppose the dairy expects its application to write into /var/lib/dairy and it has attached a new 40 GiB data volume. The existing root device still holds that directory. If the intended data filesystem has not been mounted there, an app that starts can create files in the root filesystem. Later someone mounts the data filesystem on the directory and those root-side files are hidden by the mount, while their storage remains allocated. To investigate, the operator should inspect the mount source and stop further app writes through the approved procedure before attempting recovery. A plan for a growing database therefore includes how to verify the storage is present before starting the app.
A disk-size problem has a similar boundary mismatch. If AWS reports the volume is now larger, the partition and filesystem might still use their original capacity. The operating system can see the new outer size but the database can still receive an out-of-space result from the current filesystem. The solution depends on the actual partition, optional logical volume and filesystem. A read-only check of each layer is the first step. Expansion and detachment are covered separately later in this chapter because touching the wrong layer can damage data.
| Layer | Dairy example | A question it answers |
|---|---|---|
| Application | Order MD-1052 and its accepted line items | Can the real service read the intended order? |
| Path and mount | The directory that contains orders.db | Which filesystem currently receives writes below this path? |
| Filesystem | A sized file organization inside the chosen storage layout | How much usable file capacity remains and who can access it? |
| Block device | The guest's disk and any partition or other layers | Which local device identity backs the filesystem? |
| EBS resource | The attached volume ID, configured size and AZ | Which AWS volume is this and where can it attach? |
A write can pass through multiple caches before it reaches a storage boundary. A database's own commit and durability settings matter. An in-memory number and a log message do not automatically establish that storage contains a durable transaction. For a robust restore check, use an application-defined marker with a known lifecycle and an approved backup procedure consistent with that data. Later you will rehearse the distinction on local files without mounting real disks or creating cloud resources.
Choose the storage interface from how the dairy uses the data
The order process needs to edit a database file and perform documented reads and updates on a storage device visible to one machine. EBS can provide that block device for the instance. Choosing EBS means deciding the provisioned size and settings, the responsible AZ placement and how the app accesses the filesystem. Attach a typical volume to its assigned instance in the same Availability Zone. In some compatible clustered designs, supported Provisioned IOPS volumes can use Multi-Attach in the same AZ. Attaching the same block device to several machines does not make an ordinary ext4 or XFS filesystem safe for concurrent writers. A clustered design must manage ownership, coordination and failure behavior.
The scanned delivery slips are different. Once an image is complete, the team may want to fetch it by key through an API, store many independent images and retain each according to its lifecycle. S3 exposes objects in buckets with keys. The application's interface changes to object operations. S3 is not presented to the guest as this instance's normal EBS disk. A file may be uploaded to S3 as an object, but the application should understand the semantics and permissions of that API. Do not assume a process reading a local path can use an object store without adapting its design or using a suitable supported integration.
Suppose two application instances must share a conventional directory of generated labels. A managed file service such as EFS can give supported clients a shared NFS interface, provided the network and access design match. Consider what operations the app performs and the locking, consistency and performance it needs. EFS's Regional and One Zone choices have their own placement tradeoffs. EFS can serve a useful shared file requirement while durable code and data elsewhere use other stores. If a workload uses a database, choose a supported storage architecture for that database rather than attaching every application instance to a volume containing its database files.
EC2 instance store is another form of block storage available on certain instance types. It provides temporary local storage on disks attached to the host. It can suit an app's reproducible caches and intermediate files. A failure or a lifecycle action such as stop or termination can destroy its data. Reboot alone normally preserves instance store data according to AWS's lifecycle table, which is still not a durability commitment for the only copy of an order. Give each item a home consistent with how it is accessed and whether it can be rebuilt.
Split the dairy's inventory accordingly. The expected OS image and deployment source can be reproduced from approved build artifacts. The current orders need their own durable source and recovery objective. Temporary thumbnails can be regenerated if lost. Delivery documents that other authorized systems fetch independently may be kept in a suitable object store. A shared printer queue may need coordinated work outside any one process. No single storage label decides all of these questions. State what is temporary, what is authoritative, who needs concurrent access and how you would verify recovery for each kind of data.
Read restart, stop and termination as different events
The fastest way to find a mistaken assumption is to ask what people mean by “restart the server.” Restarting a process normally leaves its storage attachment in place. Rebooting an OS has a different scope and can exercise automatic service startup. Stopping and starting an EBS-backed EC2 instance changes its compute lifecycle while preserving attached EBS volumes. Terminating an instance ends its lifetime and can delete individual EBS volumes if their attachment has the relevant delete-on-termination flag. The same word restart should not be used as shorthand for all of these consequences in a runbook.
A standard EBS-backed AMI launches the instance with a root volume. The AMI and launch configuration determine its root design, and other supported root types exist. Examine the actual block-device mappings and per-volume persistence flag. An example root may delete on termination and a separately added data volume may be configured to remain. The specific settings can differ depending on the AMI and attachment method. Guessing from the name root or orders does not establish which one is preserved. Mark the expected action per ID before ending a training host.
| Event | Typical implication to check | Dairy evidence |
|---|---|---|
| App process restart | The process's in-memory state is recreated; committed files remain on their storage. | Known completed order can be read from the intended file or database. |
| EC2 stop and start | Attached EBS data persists; instance store data is lost. | Correct volumes identified and mounts and service reverified after startup. |
| Instance termination | EBS attachments are removed and each volume is deleted or retained according to its flag. | Per-volume flag and recorded inventory show which resources should remain. |
| Volume loss or mistaken modification | The live volume's persistence does not restore earlier correct data. | Recover a separate point-in-time copy and check app result. |
| Replacement host in another AZ | The original EBS volume cannot attach across AZs. | Restore an authorized usable snapshot to a new volume in the target AZ. |
The dairy needs a clear capacity and billing record when an instance is no longer running. EBS volume costs follow the provisioned resource and applicable performance and pricing settings. An empty retained volume can still cost money. Snapshots retained after volume deletion can continue to cost money independently. Keep the volume and snapshot owners and expected expiration in the project inventory. Decide what needs retention before cleanup. Deleting a resource solely because a machine is no longer running can remove recovery evidence; keeping every disk and snapshot without review can leave an unnecessary storage bill.
Design a recovery point independently of the live volume
An EBS volume is resilient storage, with data replicated within its AZ. This helps it withstand certain underlying component failures. Replication of the current state still reflects a valid deletion or mistaken write. The dairy may need the earlier version of its order history. An EBS snapshot is a separate point-in-time representation of the blocks on the volume. Later snapshots can store changed data incrementally while each available snapshot has the information needed for its own restore. Select a recovery point according to data and retention requirements. A routine volume attachment does not automatically create that schedule.
If the dairy starts a snapshot while its app still has writes cached, that snapshot can omit those writes. If a backup needs to preserve transactions across a database and separate log volume, they must be handled together under the database's backup and consistency procedure. Depending on the application, that can involve an application-specific backup, quiescing writes, or another coordinated approach. A point-in-time block capture has a defined storage point. The app needs a usable logical state. The two requirements should both appear in a recovery plan. In the local lab a SQLite backup produces a separate completed file, which teaches the point-in-time concept but uses a different mechanism from EBS.
Suppose the data currently lives in an Availability Zone we call Zone A. To recover it to a new instance in Zone B of the same Region, create a volume from the approved completed snapshot in Zone B and identify it by its new volume ID. The restored volume is an independent resource and must meet the target instance's supported parameters. A regional snapshot can be restored in another AZ in that Region. For a different Region, plan an appropriate snapshot copy and check Region, account, permission and KMS implications. These are create and attach steps with approved resources. The original volume does not change AZ.
A newly restored volume may be available as a storage resource before it has its full initialized operating performance. Snapshot-backed data blocks can take time to load depending on the selected recovery approach. If the dairy must recover within a particular window, record when it can attach, when the app can read the expected data and when performance meets the normal workload. Those times can differ. Decide which one counts as business recovery. A completed snapshot or volume status by itself does not show that staff can retrieve the correct order under normal load.
Agree two objectives. A recovery point objective describes how much past data the business can tolerate losing measured over time. A recovery time objective describes the allowed window to get the needed service back. If orders arrive continuously and staff can re-enter at most one hour of records, a once-a-day copy may fall short even if its restores are fast. If the team has a ten-minute operation requirement, a data copy prepared once per minute still does not prove it can restore and reopen the site within ten minutes. Test the sequence with representative data and record how you measured both.
Tie together resource ownership, encryption and guest permissions
Think of three different boundaries. A cloud operator can have permission to describe or attach the assigned volume. A service accessing an encrypted volume and snapshot uses the applicable AWS KMS key and permitted operation. The operating system and database still control who can read or alter the dairy file once its filesystem is mounted. EBS encryption protects stored blocks and data moving between the EC2 instance and the encrypted volume. That does not replace permissions for code already running on that instance, and it does not mean the app's public browser traffic is protected without its own TLS design.
Record any required KMS key and its recovery scope as part of a backup plan. A team that can see the snapshot in its inventory might still fail to use it if the intended role and target account lack the necessary key permissions. A retained copy can also outlive a role or key policy change. Before a recovery relies on a snapshot, arrange an authorized test of creating and using a new volume with the intended identities. Avoid treating “encrypted” as proof that any future operator can restore it. Access must remain available to the right recovery procedure while being denied to unrelated users.
If the report cannot open the file after attaching a volume, use the boundary matching the failure. An unavailable or unmatched volume ID is cloud evidence. An attached device identified correctly but missing from the intended path is guest mount evidence. An app unable to open the file under its dedicated user needs filesystem and application access evidence. A SQL permission error is a separate authorization issue. Do not grant broad rights at all layers. Select the first check that distinguishes two plausible causes. Preserve the known owner, original mount state and recovery plan before making changes.
Lab one. See what a new process can read after a committed order
Use a new empty scratch directory you own and Python 3 with its SQLite module. You do not need AWS credentials, root access, an EC2 instance, or any block-device operation. The program uses local database files only. It gives the dairy order book an intentional path, and creates a different scratch table only in process memory to represent a running counter. Printing a row from the process does not automatically make it durable. The test checks which values a fresh process can read. This comparison models persistence beyond a process, without claiming to exercise actual AWS storage lifecycle.
Save the following as dairy_lab.py inside that empty directory. Its inputs are fixed fictional order names and numbers. It uses fixed filenames in the workspace and refuses to overwrite backup and restore destinations. Keep any existing database files elsewhere. The new file names intentionally distinguish the current order book, the recovery point and the independent restored copy. No step modifies a volume's partition table or mounts anything on the host.
from argparse import ArgumentParser
from contextlib import closing
from pathlib import Path
import sqlite3
active = Path("dairy-orders.sqlite3")
checkpoint = Path("dairy-checkpoint.sqlite3")
restored = Path("dairy-restore.sqlite3")
def readonly(path):
return sqlite3.connect(path.resolve().as_uri() + "?mode=ro", uri=True)
def print_orders(path):
with closing(readonly(path)) as db:
rows = db.execute("SELECT id, bottles FROM orders ORDER BY id").fetchall()
print(path.name, rows)
def create():
if any(path.exists() for path in (active, checkpoint, restored)):
raise SystemExit("Use a fresh empty practice folder.")
with closing(sqlite3.connect(active)) as db, db:
db.execute("CREATE TABLE orders (id TEXT PRIMARY KEY, bottles INTEGER NOT NULL)")
db.execute("INSERT INTO orders VALUES (?, ?)", ("MD-1052", 2))
with closing(sqlite3.connect(":memory:")) as working:
working.execute("CREATE TABLE cache (value INTEGER)")
working.execute("INSERT INTO cache VALUES (1)")
print("Process-owned cache:", working.execute("SELECT value FROM cache").fetchone()[0])
print_orders(active)
def backup(source, target):
if target.exists():
raise SystemExit("The requested scratch destination already exists.")
with closing(readonly(source)) as src, closing(sqlite3.connect(target)) as dst:
src.backup(dst)
if dst.execute("PRAGMA quick_check").fetchone()[0] != "ok":
raise SystemExit("Scratch copy failed integrity verification.")
print_orders(target)
def write_next():
with closing(sqlite3.connect(active.resolve().as_uri() + "?mode=rw", uri=True)) as db, db:
db.execute("INSERT INTO orders VALUES (?, ?)", ("MD-1053", 4))
print_orders(active)
parser = ArgumentParser()
parser.add_argument("action", choices=["create", "read", "checkpoint", "next", "restore"])
action = parser.parse_args().action
if action == "create":
create()
elif action == "read":
print_orders(active)
with closing(sqlite3.connect(":memory:")) as working:
cache_tables = working.execute(
"SELECT name FROM sqlite_master WHERE name = 'cache'"
).fetchall()
print("Cache tables in this fresh process:", len(cache_tables))
elif action == "checkpoint":
backup(active, checkpoint)
elif action == "next":
write_next()
elif action == "restore":
backup(checkpoint, restored)
Run these from your isolated workspace. Read the filenames and strings in the example output. The first command commits order MD-1052 in the file and prints the in-memory cache entry. The second command is an independent process. It reads the file without modifying it, sees the order, and observes that its newly constructed in-memory database has no cache table. If a learner simply changes the filename, the file read should fail rather than opening a new empty database. The script explicitly uses the SQLite read-only open mode for that check.
python3 dairy_lab.py create
python3 dairy_lab.py read
Process-owned cache: 1
dairy-orders.sqlite3 [('MD-1052', 2)]
dairy-orders.sqlite3 [('MD-1052', 2)]
Cache tables in this fresh process: 0
Write down the different lifetimes. The durable exercise file is still accessible to the second process. The temporary in-memory data was scoped to the previous process's database connection and is unavailable in the next one. The local file can still be lost if its storage fails or someone deletes it. A successful process restart test says little about a new host or lost volume. Add a recovery point and perform the restore in a different scratch file for the next step.
Lab two. Restore an earlier order book without changing the active list
Use the state left by the previous lab. The order book initially contains MD-1052. Create a separate checkpoint before writing one more committed order. Then restore the checkpoint to an independent scratch file. Each operation uses SQLite's provided backup API on the named practice data. The active file retains both committed orders. The restored file should show only the first. This demonstrates the intended ordering of a recovery point; later successful work does not travel backwards into the earlier copy.
python3 dairy_lab.py checkpoint
python3 dairy_lab.py next
python3 dairy_lab.py restore
python3 dairy_lab.py read
dairy-checkpoint.sqlite3 [('MD-1052', 2)]
dairy-orders.sqlite3 [('MD-1052', 2), ('MD-1053', 4)]
dairy-restore.sqlite3 [('MD-1052', 2)]
dairy-orders.sqlite3 [('MD-1052', 2), ('MD-1053', 4)]
Cache tables in this fresh process: 0
If the restore says its destination already exists, stop and keep the prior evidence. Start a new empty workspace for a clean rerun rather than deleting an unrecognized file. A wrong order list can show that your copy was taken later than planned, that you passed the wrong scenario state or that you read the live file. Confirm each filename and its observed rows. The quick integrity check gives structural database evidence. The expected order is separate business evidence. Both help a learner explain why a copy operation alone does not prove the restored app has the data the staff expects.
Extend the result on paper. Suppose the first order was committed at 14:05, the backup was taken at 14:10 and the second order finished at 14:12. The restored point contains the first. Staff should reconcile operations after 14:10 before switching writers to a restored copy. If a rehearsal takes five minutes from start until the intended order can be read and all other prerequisites are met, that measured five minutes describes this rehearsal only. It cannot predict a real EBS snapshot restore time, data initialization, key access or full app startup. Document the remaining evidence needed for AWS.
Finish by closing any Python run and keeping the result note. Remove only the three synthetic SQLite files and the code you created if you no longer need this private workspace. This lesson did not provision, format, detach, mount or delete resources on AWS or on the host's devices. A real recovery plan should maintain correct production and restore IDs and confirm which side should accept new orders before making a live switch. The scratch copy remains deliberately independent from active data.
Record a cloud inventory and a guest-side observation separately
For a paper drill, suppose the dairy's inventory shows the following. The volume labels are fictional identifiers. The data volume is attached to the source instance in Zone A. A new instance was prepared in Zone B. The available snapshot is in the same Region. Matter-of-fact labels make it easier to tell which resources the plan preserves and which must receive new IDs. Record the source instance and target instance separately. An operator cannot design recovery from a console screenshot that hides Region and AZ.
| Item | Placement and state | Use in the plan |
|---|---|---|
| Source instance | Zone A, uses an EBS root and a separate data volume | Existing live app and volume association |
| Data volume A | Zone A, attached, 40 GiB | Holds the active order database on the correct verified path |
| Backup point P | Same Region, captured at the agreed time and completed | Can create a separate volume for a target in Zone B |
| Target instance | Zone B | Needs its own volume in Zone B, guest mount and valid app configuration |
The same observations can be inspected in the console for an already assigned example. In the EC2 instance details, find its placement and storage attachments. Record the exact volume ID and delete-on-termination flag for both root and data. Open the named volume and read its separate state, type, provisioned size and AZ. For an authorized CLI inspection, supply the exact assigned IDs and Region through populated shell variables first. These are descriptive queries only. Do not use broad listing or modify the example's original resources in order to prove a guess.
aws ec2 describe-instances --region "$LAB_REGION" \
--instance-ids "$LAB_INSTANCE_ID" \
--query 'Reservations[].Instances[].{Instance:InstanceId,Zone:Placement.AvailabilityZone,Root:RootDeviceName,Devices:BlockDeviceMappings}' \
--output json
aws ec2 describe-volumes --region "$LAB_REGION" \
--volume-ids "$LAB_VOLUME_ID" \
--query 'Volumes[].{Volume:VolumeId,Zone:AvailabilityZone,SizeGiB:Size,Type:VolumeType,State:State,Attachments:Attachments}' \
--output json
The instance response identifies its AWS block device mapping. The volume response describes the resource and link to that instance. They cannot tell whether the guest mapped it to /var/lib/dairy. A tool such as Linux lsblk can show local devices and filesystem information. findmnt --target can identify the filesystem that really supplies a chosen existing path. df shows the usable space on the filesystem that contains that path. An operator with appropriate read authorization can check a real directory or reason from the paper drill. A device path printed in a lesson is an example, since enumeration can differ across boot and attachment events.
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS
findmnt --target /var/lib/dairy -o TARGET,SOURCE,FSTYPE,OPTIONS
df -h /var/lib/dairy
Use an approved existing path in those guest examples. If findmnt returns the root as the filesystem containing it, then that directory isn't supplied by the planned volume mount, assuming separate filesystems for this design. Confirm the expected device by stable identity before any further action. If the filesystem already matches, compare size details and the app's data path. Finally verify the authorized known order. Seeing an instance with matching storage metadata and a guest with a mounted filesystem still leaves the possibility of restored or empty data. The app observation completes the line of evidence.
Translate the dairy’s growth into a storage decision
One week the dairy owner sees a volume worksheet with 40 GiB provisioned and a filesystem reporting 34 GiB used. Before assuming six more GiB are available, ask for the real filesystem result at the order path. Filesystem overhead, reserved blocks, the partition layout and display rounding can change that subtraction. Suppose the actual user-visible available value for this example is 4 GiB. The business is adding about half a GiB per day, including its report files. A rough estimate reaches zero in eight days if that rate continues. It leaves no allowance for backups staged temporarily, order spikes or other jobs which might share the filesystem.
Write a threshold that prompts action before it becomes an outage. If the dairy wants at least three GiB free for the next large import, four GiB currently leaves one GiB of routine headroom. At half a GiB per day, that margin could disappear in two days. It is a more actionable deadline than waiting to see a full disk. Measure how much is from authoritative records, generated reports and disposable caches. An owner can move data to its authorized destination or retire only verified temporary artifacts. Increasing the volume is another storage decision when that use is expected to grow. Increasing capacity alone will not identify runaway logging or prove the app can use the newly allocated space.
Storage capacity also differs from the number of file allocations. Some filesystems can exhaust their available inodes when a job creates many tiny files, even while free data capacity remains. A read-only filesystem check can distinguish these limits on a system where that inode measure is meaningful. A successful capacity expansion cannot explain every out-of-space result. Verify the expected path, allocator and source of growth. For a one-off activity like generating a thousand temporary labels, a bounded scratch location and cleanup policy might solve the requirement without changing the only copy of the order database.
Put a date and owner beside each measure. The size recorded when the volume was provisioned is not a current forecast. Alert evidence should follow the filesystem and meaningful workload, not only the cloud capacity originally selected. If you plan an expansion, reserve time for identity verification, confirming the recovery point, extending the right guest layers and testing a known order afterward. If you plan to retire generated data, confirm it can be reproduced and whether retained backups or dependencies still need it. These checks transform disk capacity from a number in the console into a practical operating plan.
Apply the plan to the next order-book expansion
Mauli Dairy asks where to keep four items: the OS and installed website code, the only copy of the live order database, disposable report-generation scratch files, and scans referenced by an external system. Assign each item a plausible storage interface and lifecycle. Explain what the active process needs for reading and updating it. For the authoritative database, require a recoverable point and write down how to confirm the expected order after restore. For each disposable file, explain how the service reconstructs it and what operations clean it up. Give one reason a shared file interface could be appropriate for a different item.
Now schedule an incident rehearsal. The current 40 GiB data volume in Zone A is unusable. The plan includes a completed 14:10 snapshot accessible with the necessary key permissions in the Region. The alternate app is in Zone B, and the last committed order at 14:12 may need reconciliation. List the steps on paper from selecting the approved snapshot and target AZ to attaching a new volume, identifying its expected filesystem and reading the earlier order. Explain how you would keep the backup retention record independent of the volumes. The right plan preserves audit evidence and avoids trying to move the original attachment across an AZ boundary.
Make a separate version of the plan for an app process crash without a storage issue. It should verify the existing attachment, mounted source and latest committed data with a narrower scope. Compare the recovery evidence from the two incidents. Both require a working reader operation at the end. Only the AZ loss example needs to create a new volume from a recovery point. The distinction saves unnecessary work when the active data is available and protects the only copy when it is not. Do not infer which scenario occurred until you have the relevant evidence.
Practice short explanations for a storage interview
What is EBS providing to the application?
EBS supplies a virtual block device attached to an EC2 instance in the appropriate AZ. The guest organizes storage with its own partitions, logical layers and filesystems as needed. The dairy app reads a particular database file or service. Verifying that EBS exists does not show the app has the right file. Check the resource, guest view and application in that order when establishing the storage path.
What survives a stop and start, and what changes for termination?
Attached EBS volumes preserve their data over a normal stop and start of the EBS-backed instance. An instance store loses its data. Termination is different. Each EBS volume's attachment flag determines whether it is automatically deleted or kept. Inspect the actual setting and have an independent backup for data that needs recovery even when the live volume is lost or altered.
Why take a snapshot when the volume is already replicated?
The replicas serve the volume's current data within its AZ. A snapshot keeps a chosen point as a separate recovery resource. If the application writes something wrong, current replicas can still agree on the wrong state. A recovery can create a separate volume from the earlier point and verify the logical records. Snapshot frequency, permissions and application coordination are deliberate choices.
How do you provide the intended order data to an instance in another AZ?
A normal EBS volume attaches within its AZ. Use a completed, authorized snapshot in the Region to make a new volume in the target AZ, then verify both its identity and application data. A different Region requires an appropriate copy and permission plan. Recovery creates independent resources instead of reassigning the original device across the boundary.
Why can the application still report no space after an EBS increase?
The outer volume and guest allocations are separate. A partition, logical volume or filesystem can still have its old size even while AWS reports the new outer size. Check the expected mount source, each layer and its own capacity before following the correct extension procedure. The filesystem's available bytes at the write path matter to the application.
Check the lifecycle and recovery reasoning
A separate app process reads MD-1052 from the scratch file. What does that prove?
Show answer
The committed local file persisted across the two process runs. This exercise provides no AWS attachment or instance stop/start evidence.
The app currently stores orders below the root mount, despite an attached data volume. What should you check?
Show answer
Identify the filesystem supplying the actual path. An attached device can be present without being mounted at the expected directory.
Can the Zone B instance attach the original Zone A EBS volume directly?
Show answer
Its EBS volume must be in Zone B. Use an approved recovery point to create a new volume there if restoring the original data.
The second order was committed after the backup. Should a restore of that backup show it?
Show answer
No. The recovery point precedes the second order. Reconcile newer authorized activity before switching writers to restored storage.
Will a stopped instance's provisioned EBS storage necessarily have no cost?
Show answer
The attached EBS volumes persist and applicable provisioned storage charges can continue. Record their costs and the separate retained snapshot costs.
Revision cards
- Block storage
- An attached volume provides addressable blocks. The guest or application supplies filesystems and meaningful data organization.
- Root and data
- Identify what boots the host and what holds the irreplaceable data. Inspect the exact mount and delete-on-termination flag.
- AZ placement
- An EBS volume attaches in its own Availability Zone. A regional snapshot can restore a separate volume in another AZ of the Region.
- Quit versus terminate
- Process restart, instance stop and instance termination are separate events. In termination, each EBS volume follows its configured retention flag.
- Recovery point
- A distinct backup preserves an earlier state. Restore and check both storage integrity and a meaningful expected order.
- Evidence chain
- Check AWS resource identity, guest device and mount, then the app's read result. The first two don't guarantee the third.
Official references
- Amazon EBS overview, EBS volumes and Multi-Attach requirements
- EC2 root device options, instance store persistence and EBS termination behavior
- EBS snapshots, snapshot consistency considerations and volume initialization
- EBS encryption and KMS, EBS pricing and EC2 stop and start
- Amazon EFS and Amazon S3
- Inspect one EC2 instance and inspect the assigned EBS volume
- lsblk device inventory, findmnt mount observation and SQLite Backup API