ZFS: Restore a filesystem from a snapshot backup

Home -> UNIX -> Solaris -> System administration

7123 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

ZFS snapshots provide point-in-time backups of filesystems which utilize minimal disk space and CPU load. This, combined with the fact that you can make billions of billions of snapshots, makes taking frequent backups of filesystems a realistic possibility. This recipe describes restoring a filesystem from a snapshot.

To restore a snapshot called techrx/home/qmchenry@060614 (the filesystem in this case is techrx/home/qmchenry and the snapshot name is 060614), use the command:

zfs restore techrx/home/qmchenry@060614


This is a great tool which has many uses. My favorite is for installing complex application suites like JES (Sun's Java Enterprise System). These installations typicaly consist of several separate applications (directory, web, application, and mail servers) which all play together, sometimes not nicely. A little typo during the configuration can cause hours of cleanup which usually is avoided by reinstalling everything. I've played tricks with ufsdumping the filesystem after a clean install and before configuration begins, then restoring from that copy if need be.

ZFS snapshots make this substantially easier. Multiple snapshots can be taken quickly and easily as the progress continues and it is as easy as the one simple command above to rollback to any of those snapshot milestones (which can be conveniently named with something meaningful: blankslate, ldapconfig, etc.). Restoring a snapshot is fast, much quicker than restoring a ufsdump. Once you are in production and the snapshots are no longer needed, they can be easily deleted freeing up the disk space they do use.

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 writable clone of a filesystem
  ZFS: Create a snapshot of a filesystem
  ZFS: Grow or add more disk space to pool or filesystem
  Solaris: Mount filesystem with UFS logging enabled
  Solaris: unmounting a filesystem with umount
  Automatically answer yes to all fsck questions
  ZFS: Set or change the mount point of a filesystem
  Check filesystem integrity
  ZFS: Destroy or remove one or more filesystems
  Solaris 10: Create multi-terabyte UFS filesystem

 

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.