Wednesday, November 20, 2024
HomeSolarisSolaris system administrationZFS: Create a Writable Clone of a Filesystem

ZFS: Create a Writable Clone of a Filesystem

A ZFS clone is a writable copy of a snapshot of a filesystem. Fortunately, a ZFS clone is much simpler than its definition sounds. While a filesystem snapshot is read-only, a writable version can be created through cloning. Just like snapshots, clones are 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 is 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. (The USED columns show 0.)

Quinn McHenry
Quinn McHenry
Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!