View Source

h2. How to Create a ZFS File System Snapshot

A good practice is to create a snapshot of important data on a regular basis. Then, back up the snapshot to a disk or tape.

Starting in the OpenSolaris 2008.11 release, an automatic snapshot service is available to manage automatic snapshots. For more information, see http://wikis.sun.com/display/OpenSolarisInfo/How+to+Manage+Automatic+ZFS+Snapshots.

h5. Steps

# {include:root_step}
# *Create a file system for storing data.*
For example:
{code}
# /usr/sbin/zfs create rpool/export/home/data
{code}
# *Create a snapshot of a ZFS file system.*
For example, a snapshot called {{data@0805}} is created. It contains all of the file system data at the time that the snapshot was taken.
{code}
$ /usr/sbin/zfs snapshot rpool/export/home/data@0805
{code}
# *Verify the file system snapshot.*
{code}
$ /usr/sbin/zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
rpool/export/home/data@0805 0 - 77.8M -
{code}
# *(Optional) If you accidentally delete a file, you can restore it from the file system snapshot.*
For example, {{file.3}} is restored from the {{.zfs/snapshot/0805}} directory.
{code}
$ pwd
/export/home/data
# cp .zfs/snapshot/0805/file.3 file.3
# ls /export/home/data
file.1 file.2 file.3
{code}
*Tip* \- Review the automatic snapshot script that is included in this blog: http://blogs.sun.com/timf/entry/zfs_automatic_for_the_people.

{include:bottom_navigation}

The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact