Home > Articles > Operating Systems, Server > Solaris

  • Print
  • + Share This
Like this article? We recommend

Creating a Snapshot

Creating a snapshot of a master volume with Instant Image software (and generally with any PIT software) involves three components:

  • Master volume

  • Snapshot volume (also called the shadow volume)

  • Bitmap volume (a raw partition)

To create an independent snapshot (a full copy, for example), the size of the master volume and the shadow volume are identical. The bitmap volume is much smaller and is equal to:

Bitmap Size = 8KB per GB + 24KB

The examples in this article use the following parameters:

Volume

Device

Capacity

Mount Point

Master volume

/dev/rdsk/c0t0d0s6

7 GB

/export

Shadow volume

/dev/rdsk/c0t11d0s6

7 GB

/mnt/snapshot

Bitmap volume

/dev/rdsk/d0t11d0s0

80 KB

 

II Group name

BACKUP

 

 

Solstice Backup Group name

Default

 

 


Pre-Processing Script

A pre-processing script is created on the client, and initiated by the backup server. This script prepares the snapshot just before the backup operation, and consists of the following steps:

  1. Synchronizing the master volume.

  2. Locking the master volume against any modification.

  3. Initiating the update.

  4. Unlocking the master volume.

  5. Mounting the snapshot image.

The following code sample is an example of a pre-processing script.

#!/bin/sh
# need to explicit binary path when running pres/post script
PATH=/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/opt/SUNWesm/sbin
export PATH

# definition of volumes used in II
SHADOW_RAW=/dev/rdsk/c0t11d0s6
SHADOW=/dev/dsk/c0t11d0s6
PRIMARY_MNT=/export
SHADOW_MNT=/mnt/snapshot
II_GROUP=BACKUP

# we re-direct output in a logfile
exec >> /nsr/logs/snapshot.log 2>&1

# we lock the Master volumes so no I/O take place during "Quick Update"
echo "Quick update started"
lockfs -f -w $PRIMARY_MNT
iiadm -g $II_GROUP -u s 

if [ ! "$?" = 0 ] ; then
    echo "failed to update shadow volume"
    exit 1
fi
echo "Update finished."

# we wait for Instant Image to finish its operations
iiadm -g $II_GROUP -w

# Master Volume can be reactivated and ready for normal operations
lockfs -u $PRIMARY_MNT


# when doing PIT of a mounted volume, fsck must be executed on snapshot
fsck -y $SHADOW
# we mount the snapshot volume, ready to be backed up
mount $SHADOW $SHADOW_MNT

echo "Pre-Script finished"

Post-Processing Script

A post-processing script is also created so that normal operations can continue when the snapshot is complete. The post-processing script is much simpler with one purpose, to unmount the shadow volume. The following code sample is an example of a post-processing script.

#!/bin/sh
# need to explicit binary path when running pres/post script
PATH=/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/opt/SUNWesm/sbin
export PATH


SHADOW_MNT=/mnt/snapshot

II_GROUP=BACKUP

# we re-direct output in a logfile

exec >> /nsr/logs/snapshot.log 2>&1
echo " "
echo "Unmounting snapshot volume ($SHADOW_MNT)..."
echo "-----------------------------------"
umount $SHADOW_MNT
echo "Post-Script finished."
  • + Share This
  • 🔖 Save To Your Account