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
Answertopia.com

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

  




 

 

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

Backing Up a Solaris System With Installed Zones

The following procedures can be used to back up files in zones. Remember to also back up the zones' configuration files.

How to Use ufsdump to Perform Backups

You can perform full or incremental backups using the ufsdump command. This procedure backs up the zone /export/my-zone to /backup/my-zone.ufsdump, where my-zone is replaced with the name of a zone on your system. You might want to have a separate file system, for example, a file system mounted on /backup, to hold the backups.

  1. Become superuser, or assume the Primary Administrator role.

    To create the role and assign the role to a user, see Using the Solaris Management Tools With RBAC (Task Map) in System Administration Guide: Basic Administration.

  2. (Optional) Shut down the zone to put the zone in a quiescent state and to avoid creating backups of shared file systems.
    global# zlogin -S my-zone init 0
  3. Check the zone's status.
    global# zoneadm list -cv

    You will see a display similar to the following:

    ID  NAME     STATUS       PATH                           BRAND      IP
     0  global   running      /                              native     shared
     -  my-zone  installed    /export/home/my-zone           native     shared
  4. Perform the backup.
    global# ufsdump 0f /backup/my-zone.ufsdump /export/my-zone

    You will see a display similar to the following:

    DUMP: Date of this level 0 dump: Wed Aug 10 16:13:52 2005
    DUMP: Date of last level 0 dump: the epoch
    DUMP: Dumping /dev/rdsk/c0t0d0s0 (bird:/) to /backup/my-zone.ufsdump. 
    DUMP: Mapping (Pass I) [regular files]
    DUMP: Mapping (Pass II) [directories]
    DUMP: Writing 63 Kilobyte records
    DUMP: Estimated 363468 blocks (174.47MB).
    DUMP: Dumping (Pass III) [directories]
    DUMP: Dumping (Pass IV) [regular files]
    DUMP: 369934 blocks (180.63MB) on 1 volume at 432 KB/sec
    DUMP: DUMP IS DONE
  5. Boot the zone.
    global# zoneadm -z my-zone boot

How to Create a UFS Snapshot Using fssnap

This approach uses the fssnap command, which creates a temporary image of a file system intended for backup operations.

This method can be used to provide a clean, consistent backup of the zone files only, and it can be executed while zones are running. However, it is a good idea to suspend or checkpoint active applications that are updating files when the snapshot is created. An application updating files when the snapshot is created might leave these files in an internally inconsistent, truncated, or otherwise unusable state.

In the example procedure below, note the following:

  • There is a zone named my-zone under /export/home.

  • /export/home is a separate file system.

Before You Begin

The destination backup is /backup/my-zone.ufs. You must create the directory backup under /.

  1. Become superuser, or assume the Primary Administrator role.

    To create the role and assign the role to a user, see Using the Solaris Management Tools With RBAC (Task Map) in System Administration Guide: Basic Administration.

  2. Create the snapshot.
    global# fssnap -o bs=/export /export/home

    You will see a display similar to the following:

    dev/fssnap/0
  3. Mount the snapshot.
    global# mount -o ro /dev/fssnap/0 /mnt
  4. Back up my-zone from the snapshot.
    global# ufsdump 0f /backup/my-zone.ufsdump /mnt/my-zone

    You will see a display similar to the following:

    DUMP: Date of this level 0 dump: Thu Oct 06 15:13:07 2005
       DUMP: Date of last level 0 dump: the epoch
       DUMP: Dumping /dev/rfssnap/0 (pc2:/mnt) to /backup/my-zone.ufsdump.
       DUMP: Mapping (Pass I) [regular files]
       DUMP: Mapping (Pass II) [directories]
       DUMP: Writing 32 Kilobyte records
       DUMP: Estimated 176028 blocks (85.95MB).
       DUMP: Dumping (Pass III) [directories]
       DUMP: Dumping (Pass IV) [regular files]
       DUMP: 175614 blocks (85.75MB) on 1 volume at 2731 KB/sec
       DUMP: DUMP IS DONE
  5. Unmount the snapshot.
    global# umount /mnt
  6. Delete the snapshot.
    global# fssnap -d /dev/fssnap/0

    Note that the snapshot is also removed from the system when the system is rebooted.

How to Use find and cpio to Perform Backups

  1. Become superuser, or assume the Primary Administrator role.

    To create the role and assign the role to a user, see Using the Solaris Management Tools With RBAC (Task Map) in System Administration Guide: Basic Administration.

  2. Change directories to the root directory.
    global# cd /
  3. Back up my-zone files that are not loopback mounted to /backup/my-zone.cpio.
    global# find export/my-zone -fstype lofs -prune -o -local | cpio -oc -O /backup/my-zone.cpio type as one line
  4. Verify the results.
    global# ls -l backup/my-zone.cpio

    You will see a display similar to the following:

    -rwxr-xr-x   1 root     root     99680256 Aug 10 16:13 backup/my-zone.cpio

How to Print a Copy of a Zone Configuration

You should create backup files of your non-global zone configurations. You can use the backups to recreate the zones later if necessary. Create the copy of the zone's configuration after you have logged in to the zone for the first time and have responded to the sysidtool questions. This procedure uses a zone named my-zone and a backup file named my-zone.config to illustrate the process.

  1. Become superuser, or assume the Primary Administrator role.

    To create the role and assign the role to a user, see Using the Solaris Management Tools With RBAC (Task Map) in System Administration Guide: Basic Administration.

  2. Print the configuration for the zone my-zone to a file named my-zone.config.
    global# zonecfg -z my-zone export > my-zone.config
Previous Next

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