............................................................................................................................................................................
Problem:
Restore a VM that resides on a NFS Exported Datastore using Netapp Native
Snapshot, NOT VMWare snapshot. Use case is-- A virtual disk on Windows server
cannot be expanded, if that VM has snapshot on it. This method adds one more way
of restoring a VM, if you don’t have solid backup in place, and/or it can be
used as secondary plan for restoring a VM, should primary backup becomes
unavailable.
1. Find which ESXi host this VM resides on
a. This can be done either through vcenter GUI
or through the vmware scripts
b.
Look at Each Disk of the VM, EVERY virtual disk MUST be on
the NFS to be recoverable.
c. In our example,
the disks are all Netapp volumes (netappdatastore2)
2. Shutdown/power
down the VM
3. Unregister
the VM from Vcenter (Remove from Inventory) (DONT DELETE FROM DISK)
4. Login
to the ESXi host as user root, in this case, ESX-Server-01.domain.com
a.
ssh -l root@ ESX-Server-01.domain.com
b. Find the netapp volume once you log in.
c. [root@ESX-Server-01:~] df -h
Filesystem Size Used Available Used% Mounted on
NFS
20TT 15TT 5.0T 81% /vmfs/volumes/netappdatastore2
5. cd into
that file system
[root@ESX-Server-01: cd /vmfs/volumes/netappdatastore2
[root@ESX-Server-01 pwd
/vmfs/volumes/netappdatastore2
6. Make sure we have a .snapshot directory and it has snapshots for
the VM
7. cd into .snapshot
directory, and locate the snapshot desired based on timestamp.
root@ESX-Server-01:/vmfs/volumes/netappdatastore2] cd .snapshot/
[root@ESX-Server-01:/vmfs/volumes/netappdatastore2/.snapshot]
ls -l
Snapshot.1
Snapshot.2
Snapshot.3
8. Find the existing vm directory and move that directory into a
backup directory to save the existing state
[root@ESX-Server-01:/vmfs/volumes/netappdatastore2]
mv VMname VMname.backup
9. Recover the VM directory from snapshot directory, you MUST
choose the right snapshot directory by the time frame
Cd into desired snapshot.
[root@ESX-Server-01:/vmfs/volumes/netappdatastore2/.snapshot/Snapshot.3]
[root@ESX-Server-01:/vmfs/volumes/netappdatastore2/.snapshot/snapshot.3]
ls -ld VMName
10. Rsync command is recommended vs cp (rsync has the -S
option to handle sparse files more efficiently, thin allocated vmdk files
are usually sparse files - that are files with holes in the blocks).
root@ESX-Server-01:/vmfs/volumes/netappdatastore2/.snapshot/snapshot.3]
rsync -av -S VMName ../../VMName
11. Re-register
the vm in vcenter with the newly recovered directory
a. Login
to vcener
b. Brower
the ESXi host the VM was running on
c. Go to
Storage for the ESXi host and browse the storage file systems on the ESXi host
d. Browse
to the directory where you have the recovered VM files.
e. Go into
that directory and register the VM. (right click on the VM definition file, and
choose register).
12. Power
back on the VM.
No comments:
Post a Comment