ZFS: Create a writable clone of a filesystem

Contributor Icon Contributed by qmchenry Date Icon June 14, 2006  
Tag Icon Tagged: Solaris system administration

A ZFS clone is a writable copy of a snapshot of a filesystem. Phew. It’s much simpler than that sounded. While a filesystem snapshot is read-only, a writable version can be created through cloning. Just like snapshots, clones are very quick to create and use no additional space when they are created.


To create a clone, you must first create a snapshot. If you already have a snapshot, you can skip the first command in the example below. To create a snapshot and then a clone called ‘polly’ from the filesystem techrx/rex, use these commands:

zfs snapshot techrx/rex@060614
zfs clone techrx/rex@060614 techrx/polly

The new filesystem techrx/polly is mounted at /techrx/polly and is a normal ZFS filesystem (it’s just populated with the files of the original filesystem).

Both clones and snapshots show up in a ‘zfs list’ command:

zfs list
NAME USED AVAIL REFER MOUNTPOINT
techrx 472M 18.7G 28.5K /techrx
techrx/polly 0 18.7G 12.0M /techrx/polly
techrx/rex 12.0M 18.7G 12.0M /techrx/rex
techrx/rex@060614 0 - 12.0M -

At this point (nothing done with the original or clone filesystems after their creating the snapshot and clone), both the snapshot and clone use no additional disk space (USED columns show 0).

Previous recipe | Next recipe |
 

 
close Reblog this comment
blog comments powered by Disqus