Recovering VM from Snapshot clone

In the event that a server has no usable snapshot in block storage to recover from a snapshot from an identical server can be used to recover from. Both servers need to have the same functionality and can’t have unique data.

This article is relevant to a Linux VM in block storage running on a KVM host.

1. Locate the volume names for both the server that is having the problem and the server that you are going to use to clone the snapshot from with the following command:
virsh domblklist (VM Name)

2. This will result in an output of something like /dev/mapper/(volume number) Make note of both numbers.

3. Shutdown the VM having the problem.

4. Find the iscsi initiator name with the following command:
iscsiadm -m discovery -t st -p

5. it will look something like this: number) copy this whole line starting with iqn and ending with the volume number. Type it into this command to logout of the volume.
iscsiadm -m node -T (Initiator Name) -u

6. In the Blockstorage group manager locate the volume that is has failed. Set the volume to offline and then delete it. Use extreme care to make sure you remove the correct volume.

7. Locate the volume that will be used to clone and create a new snapshot.

8. select the snapshot that was created and clone it using the right click menu.

9. Give the clone the same volume number as the one that was removed previously and make sure it’s in the correct folder in the block storage pool.

10. Copy the access controls from the volume that is being cloned.

11. Locate the iscsi initiator name of the new volume create with the following command:
iscsiadm -m discovery -t st -p

12. Just like before log the initiator back in with the following command. Make note that the initiator name may be slightly different than before.
iscsiadm -m node -T (Initiator Name) -u
service multipathd restart

13. Navigate to the /mnt/ directory.

14. Make a directory with the name of the volume number that was recreated.

15. Mount the volume to the host with the following command:
Mount dev/mapper/(volume number)p1 /mnt/(volume number)

16. Update the hostname, mac address, and IP of the by modifying the following files: /mnt/(volume number/etc/sysconfig/network and /mnt/(volume number)/etc/sysconfig/network-scripts/ifcfg-eth0

17. Also edit the /mnt/(volume number)/etc/udev/rules.d/70-persist and remove all the lines from it.

18. Unmount the volume with the following command:
umount /mnt/(volume number)

19. Validate that the /mnt/(volume number) directory that was created before is empty and remove it.

20. Start the VM and verify that it is running correctly.