Skip to main content

How to manually restore a VMware ESX virtual machine from an NFS volume snapshot

https://kb.netapp.com/data-mgmt/OTV/VSC_Kbs/How_to_manually_restore_a_VMware_ESX_virtual_machine_from_an_NFS_volume_datastore_snapshot 

Applies to

  • ONTAP 9
  • Data ONTAP 8
  • ONTAP 7-Mode
  • VMware ESX

Description

This KB describes how to manually restore a VMware ESX VM from an NFS volume snapshot.

Procedure

This procedure section is broken up into several subsections.

If you are using 7-mode storage, start in additional information at Copy the VM files from your 7-mode volume then jump to Mount the NFS datastore to the ESX host

Note: The syntax of some ONTAP commands provided may not match the syntax in your version of ONTAP. Refer to your ONTAP command manual where necessary.

Copy the VM files from your clustered ONTAP volume
  1. SSH into the storage system.
  2. Run command volume snapshot show -vserver <your vserver> -volume <your volume> to identify the snapshot you want to restore from.

Example:

cluster2::> volume snapshot show -vserver NFS -volume NFS_root Vserver  Volume   Snapshot                                  Size Total% Used% -------- -------- ------------------------------------- -------- ------ ----- NFS      NFS_root                   snap1                                     68KB     0%   33%                   hourly.2015-08-24_1505                    64KB     0%   31%                   hourly.2015-08-24_1605                    64KB     0%   31%                   hourly.2015-08-24_1705                    60KB     0%   30%

 

  1. Create a FlexClone of snapshot with the command volume clone create -flexclone <your clone> -vserver <your vserver> -type RW -parent-volume <your original volume> -junction-path <your clone junction path> -foreground true -parent-snapshot <your snapshot> -space guarantee none.​​​​​

Example:

cluster2::> volume clone create -flexclone flex1 -vserver NFS -type RW -parent-volume NFS_root -junction-path /flex1 -foreground true -parent-snapshot snap1 -space-guarantee none [Job 135] Job succeeded: Successful

 

NOTE: If the snapshot name has spaces in it then you'll need to add "" to the snapshot name.

Example: 

cluster2::> volume clone create -flexclone flex1 -vserver NFS -type RW -parent-volume NFS_root -junction-path /flex1 -foreground true -parent-snapshot "snap1 clone" -space-guarantee none

 

  1. Remount the NFS datastore. For more information, see section Mount the NFS datastore to the ESX host below.
Mount the NFS datastore to the ESX host

Note: This section uses examples and terminology from vSphere Client 6.7. Some steps may differ in other vSphere Client versions.

  1. Login to the vSphere Client.
  2. Select the ESX host you want to use to perform the restore. Note: It's recommended to pick a host in maintenance mode, but maintenance mode is not required for the procedure.
  3. Navigate to Actions>Storage>New Datastore....

Example:

clipboard_efd0a2e0fa0c34dd62a241e4c306d0457.png

  1. Fill in the New Datastore... wizard with information for the newly created clone volume.
Register the VM you need to restore

Note: If the VM was powered on at the time of the backup, you may need to delete any related .lck files from the ESX host. For more information, see VMware KB 10051: Investigating virtual machine file locks on ESXi.

  1. Navigate to the restored NFS datastore.
  2. Open the Files menu.
  3. Navigate to the folder named after the VM you need to restore.
  4. Click on the .vmx file.
  5. Open the Register VM... wizard.

Example:

clipboard_e5f27d439817dbfd7bba362d67e846df9.png

  1. Follow the Register VM... wizard. Note: Do not power on the VM until completing all steps in this KB.
  2. Migrate the restored VM onto a production datastore.
Clean up the temporary NFS datastore
  1. Navigate to the temporary NFS datastore created for the restoration process.
  2. Navigate to Actions>Unmount Datastore...

Example:

clipboard_e4e949ffcf1d9d6c61fe0f1e5864c51f0.png

  1. Follow the Unmount Datastore... wizard.
  2. SSH into the storage system.
  3. Identify the temporary datastore.

Example:

FILER> vol status          Volume State           Status            Options          nfsds1 online          raid_dp, flex     create_ucode=on, guarantee=none nfsds1_restored online          raid_dp, flex     create_ucode=on, guarantee=none

 

Example:

cluster2::> volume show Vserver   Volume       Aggregate    State      Type       Size  Available Used% --------- ------------ ------------ ---------- ---- ---------- ---------- ----- NFS       NFS_root     aggr1        online     RW       2.50TB     1.76TB   25% NFS       flex1        aggr1        online     RW       2.50TB     1.76TB   25%

 

  1. Offline the cloned volume.

Example:

FILER> vol offline nfsds1_restored Fri Sep 10 11:44:12 EDT [wafl.vvol.offline:info]: Volume 'nfsds1_restored' has been set temporarily offline Volume nfsds1_restored is now offline.

 

Example:

cluster2::> volume offline -vserver NFS -volume flex1 Warning: Volume "flex1" on Vserver "NFS" must be unmounted before being taken offline or restricted.          Clients will notbe able to access the affected volume and related junction paths after that.          Do you still want to unmount the volume and continue? {y|n}: y Volume "NFS:flex1" is now offline.

 

Note: If the wrong volume is offlined, the host will lose connectivity to that storage. Confirm the volume name before running this command. If the wrong volume was offlined in this step, bring it online with command vol online <your volume>.

  1. Destroy the offlined volume.

Example:

FILER> vol destroy nfsds1_restored Are you sure you want to destroy this volume? yes Fri Sep 10 11:44:22 EDT [wafl.vvol.destroyed:info]: Volume nfsds1_restored destroyed. Volume 'nfsds1_restored' destroyed.

 

Example:

cluster2::> volume delete -vserver NFS -volume flex1 Warning: Are you sure you want to delete volume "flex1" in Vserver "NFS" ? {y|n}: y [Job 1488] Job succeeded: Successful

 

 

 

Additional Information

Note: ONTAP 7-mode entered end of limited support 31st of December 2022.

To manually restore a VMware ESX VM from a snapshot volume/LUN, refer to NetApp KB How to manually restore a VMware ESX virtual machine from a snapshot volume/LUN.

Copy the VM files from your 7-mode volume

Identify a snapshot with files you want to retrieve
  1. SSH into the storage system as root.
  2. Run command snap list <your volume> to identify the snapshot you want to restore from.

Example:

FILER1> snap list nfsds1 Volume nfsds1 working... %/used %/total date name ---------- ---------- ------------ -------- 0% ( 0%) 0% ( 0%) May 08 20:46 restoreDS

 

  1. Choose one of the three procedures below based on your licensing.

Procedure 1: Create a copy of a VMDK file or VM directory with a SnapRestore license
  1. Copy the file you need to restore with the command snap restore -s <your snapshot> -r <new file> <original file>.

Example:

FILER1> snap restore -s restoreDS -r /vol/nfsds1/test1/test1_restored.vmx /vol/nfsds1/test1/test1.vmx

 

  1. Repeat Procedure 1 Step 1 for each of the files you need to restore.

Note: If you copy the VMDK as an individual file, copy both the vmname.vmdk and a corresponding vmname-flat.vmdk. Otherwise, the VM won't recognize the copied VMDK.


Procedure 2Create a full NFS datastore restore without a FlexClone license
  1. Run the command ndmpcopy <your snapshot> <your original volume> to restore the existing volume to the snapshot.

Example:

FILER1> ndmpcopy /vol/v234/.snapshot/test3/ /vol/nfsds1

 

Note: The ndmpcopy command provided can be modified to copy the data into a new volume and/or copy individual files instead. You can read more about the command in your command manual.

  1. Remount the NFS datastore. For more information, see section Mount the NFS datastore to the ESX host further below.
Procedure 3Create a full NFS datastore restore with a FlexClone license
  1. Run the command vol clone create <your new volume> -s none -b <your original volume> <your snapshot> to create a new volume from the snapshot.

Example:

FILER1> vol clone create nfsds1_restored -s none -b nfsds1 restoreDS


 

 

Note: If there is a space in the snapshot name, surround the name in quotations. Example: "restore DS"

  1. Monitor the vclone using the command snap list <your original volume>.

Example:

FILER1> snap list nfsds1 Volume nfsds1 working... %/used %/total date name ---------- ---------- ------------ -------- 0% ( 0%) 0% ( 0%) May 08 20:46 restoreDS (busy,vclone)

 

  1. When the volume has completed cloning, ensure that it has been exported with the command exportfs.
  2. Remount the NFS datastore. For more information, see section Mount the NFS datastore to the ESX host further below.