[indiana-discuss] zfs snapshot

Haik Aftandilian haik.aftandilian at sun.com
Wed Dec 5 11:46:28 PST 2007


> zfs snapshot
> 
> It is my understanding from the documentation that a
> snapshot can be either a
> complete system 'zfs snapshot zpl_slim at today' or
>  directory structure 
> zfs snapshot -r /export/home/jhawk at today' the -r
> being recursive.

You can snapshot ZFS file systems, not arbitrary directories. So if /export/home/jhawk is its own zfs filesystem, then yes "zfs snapshot -r /export/home/jhawk at today'" would take a snapshot of it and all ZFS filesystems that are descendent of /export/home/jhawk. If you don't have zfs filesystems descendent of /export/home/jhawk, the -r wouldn't have an effect. Running zfs list shows all filesystems and their mount points.

> Thus if I do 'zfs snapshot zpl_slim at today' and then a
> clone I simply destroy 
> the clone and promote the snapshot to return to
> original state.
> 
>  example:
> # zfs snapshot zpl_slim at today
>  # zfs clome zpl_slim at today zpl_slim/test
> # zfs destroy zpl_slim/test
>  # zfs promote zpl_slim at today
> Back to original state
>
> Is this accurate?

That's a little strange because you're cloning the entire zfs_slim filesystem into a new filesystem descendent of zfs_slim. I'll assume you meant this.

# zfs snapshot zpl_slim/root at today
# zfs clone zpl_slim/root at today zpl_slim/test
# zfs destroy zpl_slim/test
# zfs promote zpl_slim/root at today

To restore zpl_slim/root to what it was at the time you took the @today snapshot, you would use "zfs rollback zpl_slim/root at today" instead of the promote you have listed. You could then destroy the @today snapshot because the contents of zpl_slim/root and zpl_slim/root at today should be identical. However, in this example, we don't show any changes being made to zpl_slim/root, so you wouldn't need to do anything to restore the contents of zpl_slim/root.

Definitely check the zfs man page and practice on some test filesystems before doing anything drastic.

Haik
--

This message posted from opensolaris.org



More information about the indiana-discuss mailing list