Linux Labs

Storage / Stage 7 of 11

LVM snapshots and rollback

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 7 · on a machine · 5 min

The snapshot is smaller than the volume

What you will learn

  • Explain what a classic LVM snapshot keeps and what it does not protect against.
  • Take a snapshot at a consistent moment and watch how its space is used.
  • Roll a volume back with a merge or restore one file from a snapshot, and check the result.

Before a configuration update, a colleague took a snapshot of the data volume and mounted it read-only at /mnt/lvm-before. After the update the service reads a wrong mode from /mnt/lvm-data/settings.conf.

Look at the group's volumes and read settings.conf through both mount points.

Exercise · look

Compare the volume and the snapshot

Look at the volumes of the lab_vg group and read settings.conf through both mount points, /mnt/lvm-data and /mnt/lvm-before. Do not edit the files.

First, predict

What will cat print through /mnt/lvm-before?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

The checkpoint snapshot is 64 MiB, and the data volume is 128 MiB. How does the snapshot show the earlier state of the whole volume?

  • There is no background copy: the snapshot fills only when blocks on the volume change. Data% for checkpoint is almost zero.

  • LVM has no idea which files matter: it works with device blocks. Everything that was on the volume reads through the snapshot.

  • LVM does not compress snapshot data. Data% for checkpoint is almost zero: the snapshot holds next to nothing so far.

The snapshot keeps the earlier versions of changed blocks and reads the unchanged ones from the volume itself.

Ubuntu 24.04
Loading…