5.19.2.2 Method 2: Back up Individual User Domains

You can back up an individual user domain by backing up its specific folder in /EXAVMIMAGES 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.

  1. Use the following script to prepare the backup destination and prepare the user domain 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 
    
    printf "Enter the name of the user domains to be backed up :"
    read userDomainName
    
    ##  Create the Backup Directory 
    
    mkdirStartTime=$(date +%s)
    find /EXAVMIMAGES/GuestImages/${userDomainName} -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" 
    
    ##  Pause the user domain
    PauseStartTime=$(date +%s)
    xm pause ${userDomainName}
    PauseEndTime=$(date +%s)
    PauseTime=$(expr ${PauseEndTime} - ${PauseStartTime})
    echo "PauseTime for guest - ${userDomainName} :" ${PauseTime}" seconds" 
    
    ## Create reflinks for all the files in /EXAVMIMAGES/GuestImages/${userDomainName}
    relinkStartTime=$(date +%s)
    find /EXAVMIMAGES/GuestImages/${userDomainName} -type f|awk '{print "reflink",$0,"/EXAVMIMAGES/Backup"$0}'|sh
    relinkEndTime=$(date +%s)
    reflinkTime=$(expr ${relinkEndTime} - ${relinkStartTime})
    echo "Reflink creation time for guest - ${userDomainName} :" ${reflinkTime}" seconds" 
    
    ## Unpause the user domain
    unPauseStartTime=$(date +%s)
    xm unpause ${userDomainName}
    unPauseEndTime=$(date +%s)
    unPauseTime=$(expr ${unPauseEndTime} - ${unPauseStartTime})
    echo "unPauseTime for guest - ${userDomainName} :" ${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.