ZFS: Create a writable clone of a filesystem

Home -> UNIX -> Solaris -> System administration

8496 views

From the computer of: qmchenry (335 recipes)
Created: Jun 14, 2006


Add a comment

Add to:
Add to stumbleuponAdd to del.icio.usDigg itAdd to FURL

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).

Subscribe to the Tech-Recipes Newsletter

You can get tips like this delivered in your email every week!

Enter your Email

We will never, ever sell your email address or spam you.





Related recipes:

  ZFS: Create a snapshot of a filesystem
  ZFS: Create a new filesystem from an existing pool
  ZFS: Create a basic filesystem or pool using zpool
  ZFS: Set or change the mount point of a filesystem
  Solaris 10: Create multi-terabyte UFS filesystem
  Solaris: Mount filesystem with UFS logging enabled
  Solaris: unmounting a filesystem with umount
  ZFS: Create a mirrored storage pool
  Automatically answer yes to all fsck questions
  Check filesystem integrity

 

Sponsored links

 

Login

Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.