Using ZFS for Zone Backups or SnapshotsDerek Crudgington, April 2006 Using ZFS for temporary zone backups or snapshots works great and is quick and easy. (Editor's note: ZFS is the new file system available in the OpenSolaris OS and scheduled for release in an update of the Solaris 10 OS.) Create a ZFS file system for # zfs create pool1/zones/zone1 # zfs set mountpoint=/zones/zone1 pool1/zones/zone1 Configure the zone and set its # zonecfg -z zone1 and so on and so forth... # zoneadm -z zone1 install # zoneadm -z zone1 boot # zlogin -C zone1 and so on and so forth... # zoneadm list -vc ID NAME STATUS PATH 0 global running / 3 zone1 running /zones/zone1 Take a snapshot of the zone just as it is and call it # zfs snapshot pool1/zones/zone1@test # zlogin zone1 [Connected to zone 'zone1' pts/2] Last login: Mon Nov 28 14:35:20 on pts/1 Sun Microsystems Inc. SunOS 5.11 snv_27 October 2007 # ls bin etc home mnt opt proc system usr dev export lib net platform sbin tmp var Make files in the zone. We will revert back to the old one without these momentarily: # mkfile 50m testfile # mkfile 100m testfile1 # ls bin export mnt platform system tmp dev home net proc testfile usr etc lib opt sbin testfile1 var # exit # zonename global
Now, back in the global zone, let's do a rollback to the snapshot where it doesn't have # zfs rollback -r pool1/zones/zone1@test cannot umount '/zones': Device busy Oops! We forgot to shut down the zone first: # zoneadm -z zone1 halt # zfs rollback -r pool1/zones/zone1@test # zoneadm -z zone1 boot This whole rollback procedure took about five seconds. Let's log in to the zone to see if the files are gone and if the rollback was successful: # zlogin zone1 [Connected to zone 'zone1' pts/2] Last login: Mon Nov 28 14:35:20 on pts/1 Sun Microsystems Inc. SunOS 5.11 snv_27 October 2007 # ls bin etc home mnt opt proc system usr dev export lib net platform sbin tmp var About the Author
Derek Crudgington can be reached at dacrud@gmail.com, or you can check out his web site at
The information and links on this page have been provided by a BigAdmin user. The submitter is solely responsible for such information and links. Sun is not responsible for the availability of external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable, directly or indirectly, for any actual or alleged damage or loss caused by or in connection with use of or reliance on the information posted here, or goods or services available on or through any external site or resource. Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License. |
| |||