Taking snapshots of VCS configuration files

Use the hasnap command to take snapshots of VCS configuration files on each node in the cluster. You can also restore the configuration from a snapshot.

The command includes the following options; each option is described in detail in the following sections:

hasnap -backup

Backs up files in a snapshot format. 

hasnap -restore

Restores a previously created snapshot. 

hasnap -display

Displays details of previously created snapshots. 

hasnap -sdiff

Displays files that were changed on the local system after a specific snapshot was created. 

hasnap -fdiff

Displays the differences between a file in the cluster and its copy stored in a snapshot. 

hasnap -export

Exports a snapshot from the local, predefined directory to the specified file. 

hasnap -include

Configures the list of files or directories to be included in new snapshots, in addition to those included automatically by the -backup command. 

hasnap -exclude

Configures the list of files or directories to be excluded from new snapshots when backing up the configuration using the -backup command. 

hasnap -delete

Deletes snapshots from the predefined local directory on each node. 

Note   With the exception of the -include, -exclude, and the -delete options, all options can be combined with the -f option. This option indicates that all files be backed up to or restored from the specified single file instead of a local, predefined directory on each node. This option is useful when you want to store the configuration data to an alternate location that is periodically backed up using backup software like Veritas Net Backup.

Backing up configuration files

The hasnap -backup command backs up files in a snapshot format. A snapshot is a collection of VCS configuration files backed up at a particular point in time, typically before making changes to the existing configuration. A snapshot also contains information such as the snapshot name, description, creation time, and file permissions.

The command backs up a predefined list of VCS configuration files as well as a user-defined list. The predefined list includes all the *.cf files, custom agents, LLT and GAB configuration files, triggers, custom heartbeats, and action scripts. See the -include and -exclude commands to construct a user-defined list.

To back up VCS configuration files

hasnap -backup [-f filename] [-n] [-m description]

Use the -n option to run the command in the non-interactive mode.

Use the -m option to specifies a description of the snapshot.


Examples

The following command creates a backup of the configuration in the non-interactive mode and adds Test Backup as the backup description.

hasnap -backup -n -m "Test Backup"

The following command creates a backup of the configuration files and saves it as /tmp/backup-2-2-2003 on the node where the command was run.

hasnap -backup -f /tmp/backup-2-2-2003

Restoring VCS configuration files

The hasnap -restore command restores configuration files from a previously created snapshot.

To restore VCS configuration files

hasnap -restore [-f filename] [-n] [-s snapid]

-n 

Run the command in the non-interactive mode. 

-s 

option to specifies the ID of the snapshot to be restored. 

If you do not specify a snapshot ID, the command lists the snapshots that are available for restoration.


Examples

The following command restores the snapshot vcs-20030101-22232 in the non-interactive mode.

hasnap -restore -n -s vcs-20030101-22232

The following command restores the snapshot stored in the file /tmp/backup-2-2-2003.

hasnap -restore -f /tmp/backup-2-2-2003

Viewing snapshots of configuration files

Use the hasnap -display command to view details of previously created snapshots.

To view snapshots of configuration files

hasnap -display [-f filename] [-list|-s snapid] [-m] [-l] [-t]

-list

Displays the list of snapshots in the repository. 

-s

Specifies the snapshot ID.

-m

Displays snapshot description.

-l

Lists files in the snapshot

-t

Displays the snapshot timestamp


If no options are specified, the command displays all information about the latest snapshot.


Examples

The following command lists all snapshots.

hasnap -display -list

The following command displays the description and the time of creation of the specified snapshot.

hasnap -display -s vcs-20030101-2232 -m -t

The following command displays the description, the timestamp, and the list of all files in the snapshot file /tmp/backup-2-2-2003

hasnap -display -f /tmp/backup-2-2-2003

Viewing files changed after a snapshot

Use the hasnap -sdiff command to display files that were changed on the local system after a specific snapshot was created.

To view files that changed after a snapshot

hasnap -sdiff [-f filename] [-s snapid] [-sys hostname]

-s

Identifies the snapshot ID of the comparison snapshot. 

-sys

Indicates the host on which the snapshot is to be compared. 

If you do not specify any options, the command uses the latest snapshot to compare the files on each node in the cluster.


Examples

The following command displays the differences between the current configuration and the snapshot vcs-20030101-22232.

hasnap -sdiff -s vcs-20030101-22232

The following command displays the difference between the configuration on system host1 and the snaphot stored in the file /tmp/backup-2-2-2003.

hasnap -sdiff -f /tmp/backup-2-2-2003 -sys host1

Comparing a file with its snapshot copy

Use the hasnap -fdiff to displays differences between a file on the cluster and its copy stored in a previously created snapshot.

To compare a file with its snapshot copy

hasnap -fdiff [-f filename] [-s snapid] [-sys hostname] file

-s

Specifies the ID of the snapshot. 

-sys

Specifies the host on which the snapshot is to be compared. 

-file

The file to compare.  

If you do not specify any options, the command uses the latest snapshot to compare the file on each node in the cluster.


Examples

The following command displays the differences between the files /etc/VRTSvcs/conf/config/main.cf on host1 and its version in the last snapshot.

hasnap -fdiff -sys host1 /etc/VRTSvcs/conf/config/main.cf

The following command displays the differences between the files /var/llttab on each node in the cluster and the version stored in the snapshot contained in the file /var/backup-2-2-2003.

hasnap -fdiff -f /tmp/backup-2-2-2003 /etc/llttab

Exporting snapshots

Use the hasnap -export command to export a snapshot from the local, predefined directory on each node in the cluster to a specified file. This option is useful when you want to store a previously created snapshot to an alternate location that is periodically backed up using backup software like Veritas NetBackup.

To export a snapshot

hasnap -export -f filename [-s snapid]

-s

Specifies the ID of the snapshot. 

-f

Specifies the file. 

If you do not specify a snapshot ID, the command exports the latest snapshot to the specified file.


Example

The following command exports data from snapshot vcs-20030101-22232 from each node in the cluster to the file /tmp/backup-2-2-2003 on the current node.

hasnap -export -f /tmp/backup-2-2-2003 -s vcs-20030101-22232

Adding and removing files for snapshots

Use the hasnap -include command to configures the list of files or directories to be included in new snapshots. This list is in addition to the files included by the -backup command.

See Backing up configuration files.

To add or remove files for a snapshots

hasnap -include -add|-del|-list [-sys hostname]

files|directories

-add

Adds the specified files or directories to the include file list.  

-del

Removes the specified files or directories from the include file list.  

files/ directories

Files or directories to be added or removed.  


Examples

The following command displays the list of files or directories to be included in new snapshots on each node of the cluster.

hasnap -include -list

The following command adds the file /opt/VRTSweb/conf/vrtsweb.xml to the include list on host1, which results in this file being included in the snapshot the next time the hasnap -backup command is run.

hasnap -include -add /opt/VRTSweb/conf/vrtsweb.xml

The following command removes the file /opt/VRTSweb/conf/vrtsweb.xml from the include list on host1.

hasnap -include -del -sys host1 /opt/VRTSweb/conf/vrtsweb.xml

Excluding files from snapshots

Use the hasnap -exclude command to configure the list of files or directories that should not be included in new snapshots.

To exclude files from snapshots

hasnap -exclude -add|-del|-list [-sys hostname]

files|directories

-add

Adds the specified files or directories to the exclude file list.  

-del

Removes the specified files or directories from the exclude file list.  

files/ directories

Files or directories to be added or removed.  


Examples

The following command displays the exclude file list on each node in the cluster.

hasnap -exclude -list

The following command adds the file /etc/VRTSvcs/conf/config/temp.cf to the exclude file list on host1, which results in this file being excluded from the snapshot the next time the hasnap -backup command is run.

hasnap -exclude -add -sys host1 /etc/VRTSvcs/conf/config/temp.cf

The following command removes the file /etc/VRTSvcs/conf/config/temp.cf from the exclude list on host1.

hasnap -exclude -del -sys host1 /etc/VRTSvcs/conf/config/temp.cf

Deleting snapshots

Use the hasnap -delete command to delete snapshots from the predefined local directory on each node.

To delete a snapshot

hasnap -delete [-s snapid]

-s 

Specifies the ID of the snapshot to be deleted. 

If you do not specify the snapshot ID, the command lists the snapshots that can be deleted.


Example

The following command deletes snapshot vcs-20030101-22232 from the cluster.

hasnap -delete -s vcs-20030101-22232