Um momento
0x30Lesson 4 of 8

Manage virtual disks and snapshots

Use disk images, copy-on-write layers, and snapshots safely.

15 min 5-question quiz 1 code exercise
By the end of this lesson you can
  • Explain when snapshots are useful and when they are risky.

A VM disk is commonly backed by an image file or block device. Many platforms use copy-on-write layers for snapshots and clones: unchanged blocks are shared, changed blocks are written separately. Snapshots are great for short-lived rollback points, but long snapshot chains can increase read amplification and complexity.

vm_demo.py
1base_gb = 20
2changes_gb = [2, 3, 1]
3print(base_gb + sum(changes_gb))
4print(len(changes_gb))
Output
26
3

Backups and snapshots are not the same thing. Snapshots are local state checkpoints; backups are durable recovery artifacts stored separately. Production operations typically prune old snapshots and keep retention policies explicit.

Key takeaways

  • Explain when snapshots are useful and when they are risky.

  • VMs are powerful when automation and guardrails stay strong.

  • Observe before scaling; recover before incidents become outages.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Practice: write Python

Write Python in the editor and run it against sample inputs. Python runs locally in your browser using a WebAssembly runtime.

Exercise 1

Compute used snapshot storage

+25 XP

Read base disk size (GB), then three delta sizes (GB). Print total used GB as one integer.

  • small chain
  • larger chain
main.py
Loading editor…

Python runs in a sandboxed browser worker with a 60 second time limit. Its runtime loads from the Pyodide CDN; your code stays in this browser.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: