5.19.2.1 Method 1: Back up All the User Domains

You can back up all the user domains by backing up the storage repository that is the /EXAVMIMAGES OCFS2 file system.

The backup destination should reside outside of the local machine, such as a writable NFS location, and be large enough to hold the backup. The space needed for the backup is proportional to the number of Oracle VMs deployed on the system, up to a maximum space of about 1.6 TB.

This procedure assumes there are 15 or less user domains per management domain.

  1. Use the following script to prepare the backup destination and prepare the user domains for backup.
    ScriptStarttime=$(date +%s)
    printf "This script is going to remove the directory /EXAVMIMAGES/Backup.
    If that is not acceptable, exit the script by typing n, manually 
    remove /EXAVMIMAGES/Backup and come back to rerun the script. Otherwise, 
    press y to continue  :"
    read proceed 
    
    if [[ ${proceed} == "n" ]] || [[  ${proceed} == "N" ]]
    then
      exit 0
    fi 
    
    rm -rf /EXAVMIMAGES/Backup 
    
    ##  Create the Backup Directory 
    
    mkdirStartTime=$(date +%s)
    find /EXAVMIMAGES -type d|grep -v 'lost+found'|awk '{print "mkdir -p /EXAVMIMAGES/Backup"$1}'|sh
    mkdirEndTime=$(date +%s)
    mkdirTime=$(expr ${mkdirEndTime} - ${mkdirStartTime})
    echo "Backup Directory creation time :" ${mkdirTime}" seconds" 
    
    ##  Create reflinks for files not in /EXAVMIMAGES/GuestImages
    relinkothesStartTime=$(date +%s)
    find /EXAVMIMAGES/ -not -path "/EXAVMIMAGES/GuestImages/*" -not -path "/EXAVMIMAGES/Backup/*" -type f|awk '{print "reflink",$0,"/EXAVMIMAGES/Backup"$0}'|sh
    relinkothesEndTime=$(date +%s)
    reflinkothesTime=$(expr ${relinkothesEndTime} - ${relinkothesStartTime})
    echo "Reflink creation time for files other than in /EXAVMIMAGES/GuestImages :" ${reflinkothesTime}" seconds" 
    
    ##  Pause the user domains
    for hostName in $(xm list|egrep -v '^Domain-0|^Name'|awk '{print $1}')
    do
    PauseStartTime=$(date +%s)
    xm pause ${hostName}
    PauseEndTime=$(date +%s)
    PauseTime=$(expr ${PauseEndTime} - ${PauseStartTime})
    echo "PauseTime for guest - ${hostName} :" ${PauseTime}" seconds" 
    
    ## Create reflinks for all the files in /EXAVMIMAGES/GuestImages
    relinkStartTime=$(date +%s)
    find /EXAVMIMAGES/GuestImages/${hostName} -type f|awk '{print "reflink",$0,"/EXAVMIMAGES/Backup"$0}'|sh
    relinkEndTime=$(date +%s)
    reflinkTime=$(expr ${relinkEndTime} - ${relinkStartTime})
    echo "Reflink creation time for guest - ${hostName} :" ${reflinkTime}" seconds" 
    
    ## Unpause the user domains
    unPauseStartTime=$(date +%s)
    xm unpause ${hostName}
    unPauseEndTime=$(date +%s)
    unPauseTime=$(expr ${unPauseEndTime} - ${unPauseStartTime})
    echo "unPauseTime for guest - ${hostName} :" ${unPauseTime}" seconds" 
    
    ScriptEndtime=$(date +%s) 
    ScriptRunTime=$(expr ${ScriptEndtime} - ${ScriptStarttime}) 
    echo "ScriptRunTime ${ScriptRunTime} seconds"
  2. Create a backup of the snapshot.

    Backup the reflink files in the /EXAVMIMAGES/Backup directory that was created with the script in Step 1 to a remote location. For example:

    1. Create a tarball file comprising of all files under /EXAVMIMAGES/Backup.
    2. Copy the tarball to a remote location.

    This allows for restore operations if the management domain (Dom0) is permanently lost or damaged.

  3. Remove the reflinks created by the script.