Sunday, December 15, 2024
HomeSolarisSolaris system administrationZFS: Restore a Filesystem from a Snapshot Backup

ZFS: Restore a Filesystem from a Snapshot Backup

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 tech-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 following command:

zfs restore techrx/home/qmchenry@060614

This is a great tool which has many uses. My favorite use is for installing complex application suites like JES (Sun’s Java Enterprise System). These installations typically 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 have played tricks with ufsdumping the filesystem after a clean install and before configuration begins and 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.

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 !!