5.19.1 Backing up the Management Domain dom0 Using Snapshot-Based Backup

This procedure describes how to take a snapshot-based backup of the management domain, dom0.

The logical volume /dev/VGExaDb/LVDoNotRemoveOrUse is a placeholder to make sure there is always free space available to create a snapshot. If you run dbserver_backup.sh, then the placeholder LVM is removed by the script, the free space is used for a snapshot, and the LVM is re-created after the snapshot is created. If you follow the manual procedure described here, then you have to perform all these tasks manually.

The values shown in the steps below are examples. All steps must be performed as the root user.

  1. Prepare a destination to hold the backup.

    The destination should reside outside of the local machine, such as a writable NFS location, and be large enough to hold the backup archive file(s). For non-customized partitions, the space needed for holding the backup is around 60 GB.

    The following commands may be used to prepare the backup destination.

    # mkdir -p /remote_FS
    
    # mount -t nfs -o rw,intr,soft,proto=tcp,nolock ip_address:/nfs_location/ /remote_FS
    

    ip_address is the IP address of the NFS server, and nfs_location is the NFS location holding the backups.

  2. Take a snapshot-based backup of the file system hosting the / (root) directory.
    1. Check for the existence of the LVDoNotRemoveOrUse logical volume.

      If this volume is present, then remove the volume to make space for the snapshot. Run the following script to check for the existence of the LVDoNotRemoveOrUse logical volume and remove it if present.

      lvm lvdisplay --ignorelockingfailure /dev/VGExaDb/LVDoNotRemoveOrUse
      if [ $? -eq 0 ]; then
        # LVDoNotRemoveOrUse logical volume exists.
        lvm lvremove -f /dev/VGExaDb/LVDoNotRemoveOrUse
        if [ $? -ne 0 ]; then
             echo "Unable to remove logical volume: LVDoNotRemoveOrUse. Unable to proceed with backup"
        fi
      fi

      If the LVDoNotRemoveOrUse logical volume does not exist, then investigate the reason and do not proceed with the steps below.

    2. Create a snapshot named LVDbSys3_snap for the file system hosting the / (root) directory.

      This example assumes LVDbSys3 is the active partition.

      # lvcreate -L1G -s -n LVDbSys3_snap /dev/VGExaDb/LVDbSys3
      
    3. Label the snapshot.
      # e2label /dev/VGExaDb/LVDbSys3_snap DBSYSOVS_SNAP
      
    4. Mount the snapshot.
      # mkdir /root/mnt
      
      # mount /dev/VGExaDb/LVDbSys3_snap /root/mnt -t ext4
      
    5. Change to the directory for the backup.
      # cd /root/mnt
      
    6. Create the backup file.
      # tar -pjcvf /remote_FS/mybackup.tar.bz2 * /boot > /tmp/backup_tar.stdout 2> /tmp/backup_tar.stderr
      
    7. Check the /tmp/backup_tar.stderr file for any significant errors.

      Errors about failing to archive open sockets, and other similar errors, can be ignored.

  3. Unmount the snapshot and remove the snapshot for the root directory.
    # cd /
    # umount /root/mnt
    # /bin/rmdir /root/mnt
    # lvremove /dev/VGExaDb/LVDbSys3_snap
  4. Unmount the NFS share.
    # umount /remote_FS
  5. Recreate the /dev/VGExaDb/LVDoNotRemoveOrUse logical volume.
    # lvm lvcreate -n LVDoNotRemoveOrUse -L1G VGExaDb