Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

System Administration Guide: Virtualization Using the Solaris Operating System
Previous Next

Cloning ZFS-Based Solaris Domains

If you are using a ZFS volume as the root disk for a domU, you can use the ZFS snapshot facilities to clone another domU with the same configuration. By taking a clone of the root disk, you can quickly provision similar domains.

For example, you might install Solaris as a guest domain, run sys-unconfig(1M), then clone that disk image for use in new Solaris domains. Installing a Solaris domain in this way requires only the configuration step, rather than a full install. The only extra storage used for the cloned domain is the amount needed for the differences between the domains.

You also have the capability to revert to a previous configuration if necessary.


Note - Any clones created from a snapshot must be destroyed before the snapshot can be destroyed.


How to Use ZFS Snapshot to Clone a Solaris DomU

If you use a ZFS volume as the virtual disk for your guest domain, you can take a snapshot of the storage. The snapshot is used to create clones.

Note that you might want to use the sys-unconfig command described in sys-unconfig(1M) in the domain before you take the snapshot. The resulting clones would not have host names or name services configured, which is also known as "as-manufactured." When it comes up, the new clone displays the configuration screens.

  1. Become superuser, or assume the Primary Administrator role.
  2. (Optional) To create a snapshot to produce domains that require sysidcfg to complete system identification, use the sys-unconfig command in a domain named domain1.
  3. Shut down domain1.
    # virsh shutdown domain1
  4. Take a snapshot of the root disk used by domain1.
    # zfs snapshot pool/domain1-root@clone
  5. Create a clone named domain2 from the snapshot domain1-root@clone.
    # zfs clone pool/domain1-root@clone pool/domain2-root
  6. (Optional) Display the snapshot and clone.
    # zfs list
    NAME                   USED  AVAIL  REFER  MOUNTPOINT
    pool                  92.0K  67.0G   9.5K  /pool
    pool/domain1          8K  67.0G     8K     /pool/domain1
    pool/domain2          8K  67.0G     8K     /pool/domain2
  7. Dump the configuration of domain1.
    # virsh dumpxml domain1 >domain1.xml
  8. Copy the configuration file domain1.xml to a file named domain2.xml.
    # cp domain1.xml domain2.xml
  9. Make the following changes in the domain2.xml file.
    1. Replace domain1 in this line:
      <name>domain1</name>

      With the new name, domain2:

      <name>domain2</name>
    2. So that virsh will generate a new domain configuration, remove the UUID line, which looks like this:
      <uuid>72bb96b6e6cf13594fb0cd1290610611</uuid>
    3. Point to the new disk by editing the following line:
      <source dev='/dev/zvol/dsk/export/domain1-root'/>

      Change domain1–root to domain2–root so that the line appears as follows:

      <source dev='/dev/zvol/dsk/export/domain2-root'/>
  10. Inform virsh about the new domain:
    # virsh define domain2.xml
  11. Boot the cloned domain.
More Information
More Information on ZFS Snapshot Features

Also see Chapter 7, Working With ZFS Snapshots and Clones, in Solaris ZFS Administration Guide.

Recovery

Thus, you can keep snapshots of the guest domain OS installations that are known to be good images, and use ZFS rollback to revert to a snapshot if the domain has a problem. For more information, see Rolling Back to a ZFS Snapshot in Solaris ZFS Administration Guide.

Previous Next

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire