ZFS Snapshots Demo (5 Minutes)
Description
This demo is a continuation of the ZFS Pooled Storage Demo, however, it could easily be adapted to work with any storage pool. We essentially create a snapshot of our existing file system, change it's state and restore the snapshot.
OpenSolaris Versions Supported
2008.05, 2008.11
Points to Hit
- ZFS Snapshots are quick and efficient.
Demo Prep
- You need a storage pool
Gotchas
None yet known
Demo
- Show the existing file systems and snapshots in the file system zfs list -t all | grep stripedpool
- Take a snapshot of your existing file system zfs snapshot stripedpool@today
- Show the new snapshot in the file system zfs list -t all | grep stripedpool. Notice it's not consuming any space, however, it does refer to the amount of space used by the file in the file system.
- Delete the file(s) in the file system.
- Copy or create a new file in the file system.
- Run zfs list -t all | grep stripedpool again. The amount of space referred to by the file system itself should change, but the snapshot still refers to the size of the file(s) deleted.
- Switch to the /stripedpool/.zfs/snapshot/today directory to show the data is still accessible.
- Switch back to /stripedpool and restore the file system zfs rollback -r stripedpool@today
- Notice everything is back how it was when the snapshot was created. Also notice the new file is gone.
- Run zfs list -t all | grep stripedpool. Notice the file system is now using the same amount to which the snapshot is referring.
Demo Cleanup
- If your moving on to the ZFS Clones Demo, do nothing, otherwise:
- cd /
- zpool destroy stripedpool