Snapshot backup

The backup process involves taking a snapshot of the data volume and securely storing it for future recovery.

Procedure

  1. Create a folder for saving the snapshots:
    mkdir /var/lib/libvirt/images/ccrt/snap-image 
  2. Take a snapshot
    virsh snapshot-create-as --domain <domain-name> <snapshot-name> --diskspec <volume1>,file=<path where snapshot-image 1 will be saved> --diskspec <volume2>,file=<path where snapshot-image 2 will be saved> --disk-only --atomic
    
     
    Sample output:
    
     # virsh snapshot-create-as --domain hsm_signer guest-state1 --diskspec vdc,file=/var/lib/libvirt/images/ccrt/snap-image/snapshotimg.qcow2 --diskspec vdb,snapshot=no --diskspec vda,snapshot=no  --disk-only --atomic
     Domain snapshot guest-state1 created
  3. View the snapshot
    virsh snapshot-list <vm_name> 
  4. List the block devices
    virsh domblklist <vm_name> 
  5. After the backup completes, perform an active-blockcommit by live-merging the contents of snapshotimg.qcow2 into data volume
    virsh blockcommit <vm_name> vdc --active --verbose --pivot 
  6. Shutdown the existing HSM signer instance by running the following command:
    virsh shutdown <domain-name>
  7. Verify the instance status:
    virsh list --all
    Sample output:
    # virsh list --all
      Id   Name           State
    ------------------------------
      1    hsm_signer   shutoff
  8. Change the directory to snapshot directory:
    cd /var/lib/libvirt/images/ccrt/snap-image
  9. Convert the snapshot to an independent image:
    qemu-img convert -O qcow2 -c <snapshot-image> <independent-image>
  10. Copy the converted image to the target LPAR.