Difference between revisions of "User:Sfiggins/NetApp Snapshot Restore Instructions"
(4 intermediate revisions by the same user not shown) | |||
Line 15: | Line 15: | ||
=== NetApp Filers === | === NetApp Filers === | ||
− | These are the administrative consoles for the NetApps. You can connect tot he Web UI for verifying some information, but you will need to | + | These are the administrative consoles for the NetApps. You can connect tot he Web UI for verifying some information, but you will need to SSH to the console (CLI) in order to perform restoration from snapshots. |
<pre> | <pre> | ||
Line 92: | Line 92: | ||
Denver - 10.255.6.229 | Denver - 10.255.6.229 | ||
</pre> | </pre> | ||
+ | |||
+ | === Virtual Machine File Primer === | ||
+ | |||
+ | This is a quick tutorial on the files that make up a virtual machine. | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | vm_name.vmdk Virtual Hard Drive 1 specifications file | ||
+ | vm_name-flat.vmdk Virtual Hard Drive 1 data file | ||
+ | |||
+ | vm_name-000001.vmdk Virtual Hard Drive 1 snapshot 1 specifications file | ||
+ | vm_name-000001-delta.vmdk Virtual Hard Drive 1 snapshot 1 data file | ||
+ | |||
+ | vm_name_1.vmdk Virtual Hard Drive 2 specifications file | ||
+ | vm_name_1-flat.vmdk Virtual Hard Drive 2 data file | ||
+ | |||
+ | vm_name_1-000001.vmdk Virtual Hard Drive 1 snapshot 1 specifications file | ||
+ | vm_name_1-000001-delta.vmdk Virtual Hard Drive 1 snapshot 1 data file | ||
+ | |||
+ | vm_name.nvram Virtual machine BIOS settines | ||
+ | |||
+ | vm_name.vmx Virtual machine BIOS or EFI configuration | ||
+ | vm_name.vmsd Mapping file for snapshots. May be null if no snapshots exist. | ||
+ | vm_name.vmxf Additional virtual machine configuration files | ||
+ | |||
+ | vm_name-65e69988.hlog Log file that is used by vCenter Server to keep track of virtual | ||
+ | machine files that must be removed after a certain operation completes | ||
+ | vm_name-8861827a.vswp Virtual machine swap file | ||
+ | vm_name-2288091770-2.vswp Virtual machine swap file | ||
+ | </pre> | ||
+ | |||
+ | [https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-CEFF6D89-8C19-4143-8C26-4B6D6734D2CB.html] | ||
== Preparation Steps == | == Preparation Steps == | ||
Line 103: | Line 135: | ||
In vCenter (or ESXi), browse to the virtual machine, and identify where the hard drive is stored. You can usually do this by viewing the virtual machine hardware stats, but you may have to look in the actual settings. | In vCenter (or ESXi), browse to the virtual machine, and identify where the hard drive is stored. You can usually do this by viewing the virtual machine hardware stats, but you may have to look in the actual settings. | ||
− | [[File:VM Hardware view.png]] | + | [[File:VM Hardware view.png|800px|thumb|center|VM Hardware view]] |
or | or | ||
− | [[File:VM_Edit_Disk.png]] | + | [[File:VM_Edit_Disk.png|800px|thumb|center|VM Edit view]] |
In this case, we are looking for volume den1_datastore_2 and path /den1-mfa1. | In this case, we are looking for volume den1_datastore_2 and path /den1-mfa1. | ||
Line 195: | Line 227: | ||
</pre> | </pre> | ||
− | Here, we see that we would | + | Here, we see that we would need to restore '''den1-kafka2_1-flat.vmdk''', however in vSphere, it is only going to look like '''den1-kafka2_1.vmdk'''. This machine also has two virtual hard disks, so make sure you know which disk you want to restore, or if you need to restore both. |
[[File:VM_Other_Disk_file.png]] | [[File:VM_Other_Disk_file.png]] | ||
Line 410: | Line 442: | ||
Success! You can restore power on your virtual machine. | Success! You can restore power on your virtual machine. | ||
+ | |||
+ | == Alternate / Slower Directory Restore == | ||
+ | |||
+ | As an alternate, you can restore directories utilizing the helper machine to copy from the snapshot. This will take much longer since it has to copy the data, so it really should not be used. | ||
+ | |||
+ | From the helper machine: | ||
+ | |||
+ | <pre> | ||
+ | [sfiggins@test-centos den1-mfa1]$ sudo mv /mnt/den1_datastore_2/den1-mfa1{,.old} | ||
+ | [sfiggins@test-centos den1-mfa1]$ sudo cp -pr /mnt/den1_datastore_2/.snapshot/daily.2022-11-15_0010/den1-mfa1 /mnt/den1_datastore_2/den1-mfa1 | ||
+ | </pre> | ||
+ | |||
+ | Now validate your copy. | ||
+ | |||
+ | <pre> | ||
+ | [sfiggins@test-centos den1-mfa1]$ ls -la /mnt/den1_datastore_2/den1-mfa1/ | ||
+ | drwxr-xr-x. 2 root root 4096 Jun 2 22:05 . | ||
+ | drwxr-xr-x. 176 root root 20480 Nov 14 17:09 .. | ||
+ | -rw-------. 1 root root 7516270592 Nov 14 17:10 den1-mfa1-000001-delta.vmdk | ||
+ | -rw-------. 1 root root 299 Jun 2 22:05 den1-mfa1-000001.vmdk | ||
+ | -rw-r--r--. 1 root root 92 Aug 12 2021 den1-mfa1-5c17aff3.hlog | ||
+ | -rw-------. 1 root root 8589934592 Mar 22 2022 den1-mfa1-d02c852f.vswp | ||
+ | -rw-------. 1 root root 38654705664 Jun 2 22:05 den1-mfa1-flat.vmdk | ||
+ | -rw-------. 1 root root 8684 Mar 22 2022 den1-mfa1.nvram | ||
+ | -rw-------. 1 root root 20621 Jun 2 22:05 den1-mfa1-Snapshot4.vmsn | ||
+ | -rw-------. 1 root root 552 May 9 2022 den1-mfa1.vmdk | ||
+ | -rw-------. 1 root root 387 Jun 2 22:05 den1-mfa1.vmsd | ||
+ | -rwx------. 1 root root 3599 Jun 2 22:05 den1-mfa1.vmx | ||
+ | -rw-------. 1 root root 0 Mar 22 2022 den1-mfa1.vmx.lck | ||
+ | -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-2d07bf5000000000 | ||
+ | -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5470bf5000000000 | ||
+ | -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5870bf5000000000 | ||
+ | -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-6070bf5000000000 | ||
+ | -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-9e72bf5000000000 | ||
+ | -rw-r--r--. 1 root root 235283 Mar 22 2022 vmware-10.log | ||
+ | -rw-------. 1 root root 242976 Mar 22 2022 vmware-11.log | ||
+ | -rw-r--r--. 1 root root 205083 Mar 31 2021 vmware-6.log | ||
+ | -rw-r--r--. 1 root root 201190 Apr 1 2021 vmware-7.log | ||
+ | -rw-r--r--. 1 root root 402360 Apr 16 2021 vmware-8.log | ||
+ | -rw-r--r--. 1 root root 249333 Aug 12 2021 vmware-9.log | ||
+ | -rw-------. 1 root root 248885 Jun 2 22:05 vmware.log | ||
+ | -rw-------. 1 root root 90177536 Mar 22 2022 vmx-den1-mfa1-3492578607-1.vswp | ||
+ | </pre> | ||
+ | |||
+ | Now your files are restored. | ||
+ | |||
+ | == Cleanup == | ||
+ | |||
+ | If you made a copy or renamed the old directory, don't forget to go clean up the datastore. |
Latest revision as of 23:38, 16 November 2022
Instructions on how to restore from NetApp Snapshot for ESXi machines
Basic Information
Helper Virtual Machines
These are machines that you will need to get into in order to validate the snapshots and file paths. ESXi / vCenter datastore browser hides certain files, so you need to know the exact file structure and path on order to restore.
Denver - 10.255.6.228 Dallas - 10.255.8.228
NetApp Filers
These are the administrative consoles for the NetApps. You can connect tot he Web UI for verifying some information, but you will need to SSH to the console (CLI) in order to perform restoration from snapshots.
DEN1-AFF220 - 10.255.6.223 DAL1-AFF220 - 10.255.8.223
NetApp vServers
Each NetApp has a number of vServers associated with it. In order to restore, you will need to know what vServer you are restoring from.
DEN1-AFF220::> vserver show Admin Operational Root Vserver Type Subtype State State Volume Aggregate ----------- ------- ---------- ---------- ----------- ---------- ---------- AFF220-01 node - - - - - AFF220-02 node - - - - - DEN-SYSLOG data default running running DENSYSLOG_ cifs_ root datastore_ 1 DEN1-AFF220 admin - - - - - DEN1-VCIFS2 data default running running DEN1VCIFS2 cifs_ _root datastore_ 1 DEN1-VFILER-1 data default running running DEN1VFILER cifs_ 1_root datastore_ 1 iscsi data default running running iscsi_root iscsi_ datastore_ 2 7 entries were displayed.
For vSphere hosts, this will be the following vServers, however these instructions would be valid for other vServers outside of sSphere.
Denver - DEN1-VFILER-1 Dallas - DAL-VFILER-1
NOTE: Dallas and Denver naming formats are slightly different in this case, so verify that you have the correct vServer before continuing.
NetApp Volumes
You can get this from vCenter, however it is usually a good idea to validate the volumes on the NetApp filer.
DEN1-AFF220::> volume show -vserver DEN1-VFILER-1 Vserver Volume Aggregate State Type Size Available Used% --------- ------------ ------------ ---------- ---- ---------- ---------- ----- DEN1-VFILER-1 DEN1VFILER1_root cifs_datastore_1 online RW 1GB 971.8MB 0% DEN1-VFILER-1 den1_datastore_1 cifs_datastore_1 online RW 22TB 1.60TB 67% DEN1-VFILER-1 den1_datastore_2 iscsi_datastore_2 online RW 16TB 914.8GB 77% 3 entries were displayed.
NOTE: Volume names may vary. Please validate the volume that you are wanting to restore.
vCenter
vCenter is what you will need to use in order to control the virtual machine. Below is the vCenter server information.
Denver - 10.255.6.229
Virtual Machine File Primer
This is a quick tutorial on the files that make up a virtual machine.
vm_name.vmdk Virtual Hard Drive 1 specifications file vm_name-flat.vmdk Virtual Hard Drive 1 data file vm_name-000001.vmdk Virtual Hard Drive 1 snapshot 1 specifications file vm_name-000001-delta.vmdk Virtual Hard Drive 1 snapshot 1 data file vm_name_1.vmdk Virtual Hard Drive 2 specifications file vm_name_1-flat.vmdk Virtual Hard Drive 2 data file vm_name_1-000001.vmdk Virtual Hard Drive 1 snapshot 1 specifications file vm_name_1-000001-delta.vmdk Virtual Hard Drive 1 snapshot 1 data file vm_name.nvram Virtual machine BIOS settines vm_name.vmx Virtual machine BIOS or EFI configuration vm_name.vmsd Mapping file for snapshots. May be null if no snapshots exist. vm_name.vmxf Additional virtual machine configuration files vm_name-65e69988.hlog Log file that is used by vCenter Server to keep track of virtual machine files that must be removed after a certain operation completes vm_name-8861827a.vswp Virtual machine swap file vm_name-2288091770-2.vswp Virtual machine swap file
Preparation Steps
vCenter / ESXi - Shutdown the virtual machine
Because you will be restoring a disk image you will need to shut down the virtual machine. You will do this by logging into vCenter (or ESXi in some instances), navigating the the virtual machine, and powering it off. You may want to shut down from the OS, however the disk will be replaced, so disk consistency isn't important. You may just use vSphere to power it off rather than shutting it down.
vCenter / ESXi - Verify disk location
In vCenter (or ESXi), browse to the virtual machine, and identify where the hard drive is stored. You can usually do this by viewing the virtual machine hardware stats, but you may have to look in the actual settings.
or
In this case, we are looking for volume den1_datastore_2 and path /den1-mfa1.
Verify files from the helper machine
Log into the helper machine, and verify the files.
$ ssh 10.255.6.228 sfiggins@10.255.6.228's password: Last login: Wed Nov 16 09:58:06 2022 from 10.255.22.138 [sfiggins@test-centos ~]$ cd /mnt/den1_datastore_2/den1-mfa1 [sfiggins@test-centos den1-mfa1]$ ls -la total 39304696 drwxr-xr-x. 2 root root 4096 Nov 16 12:03 . drwxr-xr-x. 207 root root 20480 Nov 16 12:30 .. -rw-------. 1 root root 2483105792 Nov 16 12:38 den1-mfa1-000001-delta.vmdk -rw-------. 1 root root 353 Nov 16 12:02 den1-mfa1-000001.vmdk -rw-r--r--. 1 root root 92 Aug 12 2021 den1-mfa1-5c17aff3.hlog -rw-------. 1 root root 8589934592 Mar 22 2022 den1-mfa1-d02c852f.vswp -rw-------. 1 root root 38654705664 Nov 16 11:52 den1-mfa1-flat.vmdk -rw-------. 1 root root 8684 Mar 22 2022 den1-mfa1.nvram -rw-------. 1 root root 8603590692 Nov 16 11:53 den1-mfa1-Snapshot5.vmsn -rw-------. 1 root root 552 Nov 16 10:50 den1-mfa1.vmdk -rw-------. 1 root root 474 Nov 16 11:52 den1-mfa1.vmsd -rwx------. 1 root root 3817 Nov 16 12:03 den1-mfa1.vmx -rw-------. 1 root root 47 Nov 16 12:02 den1-mfa1.vmxf -rw-------. 1 root root 0 Nov 16 10:28 den1-mfa1.vmx.lck -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-2d07bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5470bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:38 .lck-5627bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:38 .lck-5727bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5870bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-6070bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-9e72bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:38 .lck-db2fbf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:38 .lck-dc0dbf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:38 .lck-dd2fbf5000000000 -rw-r--r--. 1 root root 235283 Mar 22 2022 vmware-10.log -rw-------. 1 root root 242976 Mar 22 2022 vmware-11.log -rw-------. 1 root root 248885 Jun 2 22:05 vmware-12.log -rw-r--r--. 1 root root 201190 Apr 1 2021 vmware-7.log -rw-r--r--. 1 root root 402360 Apr 16 2021 vmware-8.log -rw-r--r--. 1 root root 249333 Aug 12 2021 vmware-9.log -rw-------. 1 root root 280951 Nov 16 12:33 vmware.log -rw-------. 1 root root 90177536 Mar 22 2022 vmx-den1-mfa1-3492578607-1.vswp -rw-------. 1 root root 90177536 Nov 16 10:28 vmx-den1-mfa1-3492578607-2.vswp
In this case, we are looking for the latest disk file. For this machine, which contains an vSphere snapshot, we are wanting to address the den1-mfa1-000001-delta.vmdk file.
NOTE: In vSphere, you will not see this file, and it will show you the WRONG file.
In another machine, no snapshot exists, we re restore a different file.
[sfiggins@test-centos den1-kafka2]$ ls -la total 101769292 drwxr-xr-x. 2 root root 4096 Jun 21 09:51 . drwxr-xr-x. 209 root root 20480 Nov 16 12:56 .. -rw-------. 1 root root 70866960384 Nov 16 12:57 den1-kafka2_1-flat.vmdk -rw-------. 1 root root 480 Jun 21 09:04 den1-kafka2_1.vmdk -rw-r--r--. 1 root root 92 Aug 18 2021 den1-kafka2-65e69988.hlog -rw-------. 1 root root 8589934592 Apr 1 2021 den1-kafka2-8861827a.vswp -rw-------. 1 root root 38654705664 Nov 16 12:57 den1-kafka2-flat.vmdk -rw-------. 1 root root 8684 Apr 16 2021 den1-kafka2.nvram -rw-------. 1 root root 554 Jun 21 09:51 den1-kafka2.vmdk -rw-r--r--. 1 root root 43 Jun 21 09:51 den1-kafka2.vmsd -rwxr-xr-x. 1 root root 3510 Jun 21 09:51 den1-kafka2.vmx -rw-------. 1 root root 0 Aug 18 2021 den1-kafka2.vmx.lck -rwxrwxr-x. 1 root root 92 Nov 16 12:57 .lck-3d69bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:57 .lck-4369bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:57 .lck-7a40bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:57 .lck-cb72bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 12:57 .lck-ef05bf5000000000 -rw-------. 1 root root 203317 Jan 19 2021 vmware-2.log -rw-r--r--. 1 root root 197120 Mar 30 2021 vmware-3.log -rw-r--r--. 1 root root 196887 Apr 1 2021 vmware-4.log -rw-r--r--. 1 root root 247564 Apr 16 2021 vmware-5.log -rw-r--r--. 1 root root 235945 Aug 12 2021 vmware-6.log -rw-r--r--. 1 root root 232223 Aug 18 2021 vmware-7.log -rw-r--r--. 1 root root 292598 Jun 21 09:51 vmware.log -rw-------. 1 root root 90177536 Aug 18 2021 vmx-den1-kafka2-2288091770-2.vswp
Here, we see that we would need to restore den1-kafka2_1-flat.vmdk, however in vSphere, it is only going to look like den1-kafka2_1.vmdk. This machine also has two virtual hard disks, so make sure you know which disk you want to restore, or if you need to restore both.
Validate Snapshots
On the NetApp, validate the snapshot you want to restore. In this case, we are looking for volume den1_datastore_2 on vfiler DEN1-VFILER-1.
DEN1-AFF220::> volume snapshot show -vserver DEN1-VFILER-1 -volume den1_datastore_2 ---Blocks--- Vserver Volume Snapshot Size Total% Used% -------- -------- ------------------------------------- -------- ------ ----- DEN1-VFILER-1 den1_datastore_2 weekly.2022-10-02_0015 634.9GB 4% 9% weekly.2022-10-09_0015 606.6GB 4% 9% weekly.2022-10-16_0015 602.4GB 4% 9% weekly.2022-10-23_0015 471.7GB 3% 7% weekly.2022-10-30_0015 572.7GB 3% 8% weekly.2022-11-06_0015 534.7GB 3% 8% daily.2022-11-11_0010 469.2GB 3% 7% daily.2022-11-12_0010 499.2GB 3% 7% daily.2022-11-13_0010 131.5MB 0% 0% weekly.2022-11-13_0015 357.3GB 2% 5% daily.2022-11-14_0010 249.3GB 2% 4% daily.2022-11-15_0010 558.2GB 3% 8% daily.2022-11-16_0010 292.2GB 2% 4% hourly.2022-11-16_0705 480.8MB 0% 0% hourly.2022-11-16_0805 79.08GB 0% 1% hourly.2022-11-16_0905 418.2MB 0% 0% hourly.2022-11-16_1005 447.4MB 0% 0% hourly.2022-11-16_1105 102.8GB 1% 2% hourly.2022-11-16_1205 78.97GB 0% 1% hourly.2022-11-16_1305 631.0MB 0% 0% hourly.2022-11-16_1405 93.64GB 1% 1% hourly.2022-11-16_1505 94.00GB 1% 1% hourly.2022-11-16_1605 139.0GB 1% 2% hourly.2022-11-16_1905 336.8MB 0% 0% hourly.2022-11-16_2005 0B 0% 0% 25 entries were displayed.
From here, we pick the snapshot we wish to restore from. Let's sy we want to restore from daily.2022-11-15_0010.
NOTE: Times may be in UTC. Be aware of the time zone and restore from the correct snapshot.
View Files in Snapshot
View the files on the helper machine to ensure that you have the correct time / date attributes for that you want to restore.
[sfiggins@test-centos den1-mfa1]$ ls -la /mnt/den1_datastore_2/.snapshot/daily.2022-11-15_0010/den1-mfa1/ total 35676064 drwxr-xr-x. 2 root root 4096 Jun 2 22:05 . drwxr-xr-x. 176 root root 20480 Nov 14 17:09 .. -rw-------. 1 root root 7516270592 Nov 14 17:10 den1-mfa1-000001-delta.vmdk -rw-------. 1 root root 299 Jun 2 22:05 den1-mfa1-000001.vmdk -rw-r--r--. 1 root root 92 Aug 12 2021 den1-mfa1-5c17aff3.hlog -rw-------. 1 root root 8589934592 Mar 22 2022 den1-mfa1-d02c852f.vswp -rw-------. 1 root root 38654705664 Jun 2 22:05 den1-mfa1-flat.vmdk -rw-------. 1 root root 8684 Mar 22 2022 den1-mfa1.nvram -rw-------. 1 root root 20621 Jun 2 22:05 den1-mfa1-Snapshot4.vmsn -rw-------. 1 root root 552 May 9 2022 den1-mfa1.vmdk -rw-------. 1 root root 387 Jun 2 22:05 den1-mfa1.vmsd -rwx------. 1 root root 3599 Jun 2 22:05 den1-mfa1.vmx -rw-------. 1 root root 0 Mar 22 2022 den1-mfa1.vmx.lck -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-2d07bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5470bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5870bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-6070bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-9e72bf5000000000 -rw-r--r--. 1 root root 235283 Mar 22 2022 vmware-10.log -rw-------. 1 root root 242976 Mar 22 2022 vmware-11.log -rw-r--r--. 1 root root 205083 Mar 31 2021 vmware-6.log -rw-r--r--. 1 root root 201190 Apr 1 2021 vmware-7.log -rw-r--r--. 1 root root 402360 Apr 16 2021 vmware-8.log -rw-r--r--. 1 root root 249333 Aug 12 2021 vmware-9.log -rw-------. 1 root root 248885 Jun 2 22:05 vmware.log -rw-------. 1 root root 90177536 Mar 22 2022 vmx-den1-mfa1-3492578607-1.vswp
Here, you can see that our target file den1-mfa1-000001-delta.vmdk has a date that is attractive to us.
Restore from Snapshot
Not you should be able to restore from the snapshot.
NOTE: THIS SYNTAX IS VERY CRITICAL, OR YOU WILL HAVE A BAD DAY!
Single file
From the NetApp Console:
DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1-000001-delta.vmdk
From the Helper:
[sfiggins@test-centos den1-mfa1]$ ls -la /mnt/den1_datastore_2/den1-mfa1/ total 39307912 drwxr-xr-x. 2 root root 4096 Nov 16 12:03 . drwxr-xr-x. 211 root root 20480 Nov 16 13:20 .. -rw-------. 1 root root 7516270592 Nov 14 17:10 den1-mfa1-000001-delta.vmdk -rw-------. 1 root root 353 Nov 16 12:02 den1-mfa1-000001.vmdk -rw-r--r--. 1 root root 92 Aug 12 2021 den1-mfa1-5c17aff3.hlog -rw-------. 1 root root 8589934592 Mar 22 2022 den1-mfa1-d02c852f.vswp -rw-------. 1 root root 38654705664 Nov 16 11:52 den1-mfa1-flat.vmdk -rw-------. 1 root root 8684 Mar 22 2022 den1-mfa1.nvram -rw-------. 1 root root 8603590692 Nov 16 11:53 den1-mfa1-Snapshot5.vmsn -rw-------. 1 root root 552 Nov 16 10:50 den1-mfa1.vmdk -rw-------. 1 root root 474 Nov 16 11:52 den1-mfa1.vmsd -rwx------. 1 root root 3817 Nov 16 12:03 den1-mfa1.vmx -rw-------. 1 root root 47 Nov 16 12:02 den1-mfa1.vmxf -rw-------. 1 root root 0 Nov 16 10:28 den1-mfa1.vmx.lck -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-2d07bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5470bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 13:30 .lck-5627bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 13:30 .lck-5727bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5870bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-6070bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-9e72bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 13:30 .lck-db2fbf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 13:30 .lck-dc0dbf5000000000 -rwxrwxr-x. 1 root root 92 Nov 16 13:30 .lck-dd2fbf5000000000 -rw-r--r--. 1 root root 235283 Mar 22 2022 vmware-10.log -rw-------. 1 root root 242976 Mar 22 2022 vmware-11.log -rw-------. 1 root root 248885 Jun 2 22:05 vmware-12.log -rw-r--r--. 1 root root 201190 Apr 1 2021 vmware-7.log -rw-r--r--. 1 root root 402360 Apr 16 2021 vmware-8.log -rw-r--r--. 1 root root 249333 Aug 12 2021 vmware-9.log -rw-------. 1 root root 281027 Nov 16 12:55 vmware.log -rw-------. 1 root root 90177536 Mar 22 2022 vmx-den1-mfa1-3492578607-1.vswp -rw-------. 1 root root 90177536 Nov 16 10:28 vmx-den1-mfa1-3492578607-2.vswp
The file has been restored, and you can now bring the virtual machine back up.
NOTE: In this partucular case, it looks like the den1-mfa1-000001.vmdk file is newer, and may need to be restored from teh same snapshot. This is not always the case, and is particular to the machine used in this example. This machine had the vSphere snapshot removed and then a new one created after the NetApp snapshot.
Whole Directory
There is no single command to restore an entire directory from a snapshot. The easiest way would be to restore each file, however you may want to do some additional work to ensure that it works well, If our example above, the number of files is small enough to do it by hand, however if you are dealing with many more files, you may want to use a script to generate the commands, or use an alternative / slower method that will work on directories. I'll include that in another section.
From the helper machine, we will rename the old directory as a safegard and then create a new one to restore to.
[sfiggins@test-centos den1-mfa1]$ sudo mv /mnt/den1_datastore_2/den1-mfa1{,.old} [sfiggins@test-centos den1-mfa1]$ sudo nkdir /mnt/den1_datastore_2/den1-mfa1
From the NetApp console, you will run the restore-file command for each file.
DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1-000001-delta.vmdk DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1-000001.vmdk DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1-5c17aff3.hlog DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1-d02c852f.vswp DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1-flat.vmdk DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1.nvram DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1-Snapshot4.vmsn DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1.vmdk DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1.vmsd DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1.vmx DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/den1-mfa1.vmx.lck DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/.lck-2d07bf5000000000 DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/.lck-5470bf5000000000 DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/.lck-5870bf5000000000 DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/.lck-6070bf5000000000 DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/.lck-9e72bf5000000000 DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/vmware-10.log DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/vmware-11.log DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/vmware-6.log DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/vmware-7.log DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/vmware-8.log DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/vmware-9.log DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/vmware.log DEN1-AFF220::> volume snapshot restore-file -vserver DEN1-VFILER-1 -volume den1_datastore_2 -snapshot daily.2022-11-15_0010 -path /den1-mfa1/vmx-den1-mfa1-3492578607-1.vswp
Now you can verify the restore from the helper machine.
[sfiggins@test-centos den1-mfa1]$ ls -la /mnt/den1_datastore_2/den1-mfa1/ drwxr-xr-x. 2 root root 4096 Jun 2 22:05 . drwxr-xr-x. 176 root root 20480 Nov 14 17:09 .. -rw-------. 1 root root 7516270592 Nov 14 17:10 den1-mfa1-000001-delta.vmdk -rw-------. 1 root root 299 Jun 2 22:05 den1-mfa1-000001.vmdk -rw-r--r--. 1 root root 92 Aug 12 2021 den1-mfa1-5c17aff3.hlog -rw-------. 1 root root 8589934592 Mar 22 2022 den1-mfa1-d02c852f.vswp -rw-------. 1 root root 38654705664 Jun 2 22:05 den1-mfa1-flat.vmdk -rw-------. 1 root root 8684 Mar 22 2022 den1-mfa1.nvram -rw-------. 1 root root 20621 Jun 2 22:05 den1-mfa1-Snapshot4.vmsn -rw-------. 1 root root 552 May 9 2022 den1-mfa1.vmdk -rw-------. 1 root root 387 Jun 2 22:05 den1-mfa1.vmsd -rwx------. 1 root root 3599 Jun 2 22:05 den1-mfa1.vmx -rw-------. 1 root root 0 Mar 22 2022 den1-mfa1.vmx.lck -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-2d07bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5470bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5870bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-6070bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-9e72bf5000000000 -rw-r--r--. 1 root root 235283 Mar 22 2022 vmware-10.log -rw-------. 1 root root 242976 Mar 22 2022 vmware-11.log -rw-r--r--. 1 root root 205083 Mar 31 2021 vmware-6.log -rw-r--r--. 1 root root 201190 Apr 1 2021 vmware-7.log -rw-r--r--. 1 root root 402360 Apr 16 2021 vmware-8.log -rw-r--r--. 1 root root 249333 Aug 12 2021 vmware-9.log -rw-------. 1 root root 248885 Jun 2 22:05 vmware.log -rw-------. 1 root root 90177536 Mar 22 2022 vmx-den1-mfa1-3492578607-1.vswp
Success! You can restore power on your virtual machine.
Alternate / Slower Directory Restore
As an alternate, you can restore directories utilizing the helper machine to copy from the snapshot. This will take much longer since it has to copy the data, so it really should not be used.
From the helper machine:
[sfiggins@test-centos den1-mfa1]$ sudo mv /mnt/den1_datastore_2/den1-mfa1{,.old} [sfiggins@test-centos den1-mfa1]$ sudo cp -pr /mnt/den1_datastore_2/.snapshot/daily.2022-11-15_0010/den1-mfa1 /mnt/den1_datastore_2/den1-mfa1
Now validate your copy.
[sfiggins@test-centos den1-mfa1]$ ls -la /mnt/den1_datastore_2/den1-mfa1/ drwxr-xr-x. 2 root root 4096 Jun 2 22:05 . drwxr-xr-x. 176 root root 20480 Nov 14 17:09 .. -rw-------. 1 root root 7516270592 Nov 14 17:10 den1-mfa1-000001-delta.vmdk -rw-------. 1 root root 299 Jun 2 22:05 den1-mfa1-000001.vmdk -rw-r--r--. 1 root root 92 Aug 12 2021 den1-mfa1-5c17aff3.hlog -rw-------. 1 root root 8589934592 Mar 22 2022 den1-mfa1-d02c852f.vswp -rw-------. 1 root root 38654705664 Jun 2 22:05 den1-mfa1-flat.vmdk -rw-------. 1 root root 8684 Mar 22 2022 den1-mfa1.nvram -rw-------. 1 root root 20621 Jun 2 22:05 den1-mfa1-Snapshot4.vmsn -rw-------. 1 root root 552 May 9 2022 den1-mfa1.vmdk -rw-------. 1 root root 387 Jun 2 22:05 den1-mfa1.vmsd -rwx------. 1 root root 3599 Jun 2 22:05 den1-mfa1.vmx -rw-------. 1 root root 0 Mar 22 2022 den1-mfa1.vmx.lck -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-2d07bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5470bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-5870bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-6070bf5000000000 -rwxrwxr-x. 1 root root 92 Nov 14 17:09 .lck-9e72bf5000000000 -rw-r--r--. 1 root root 235283 Mar 22 2022 vmware-10.log -rw-------. 1 root root 242976 Mar 22 2022 vmware-11.log -rw-r--r--. 1 root root 205083 Mar 31 2021 vmware-6.log -rw-r--r--. 1 root root 201190 Apr 1 2021 vmware-7.log -rw-r--r--. 1 root root 402360 Apr 16 2021 vmware-8.log -rw-r--r--. 1 root root 249333 Aug 12 2021 vmware-9.log -rw-------. 1 root root 248885 Jun 2 22:05 vmware.log -rw-------. 1 root root 90177536 Mar 22 2022 vmx-den1-mfa1-3492578607-1.vswp
Now your files are restored.
Cleanup
If you made a copy or renamed the old directory, don't forget to go clean up the datastore.