VMware Cloud Community
FBC1
Contributor
Contributor
Jump to solution

Consolidate Snapshots of disconnected drive

On our old esxi 6 host is a vm that i need files from. The drive in question got removed from the vm due to security reasons, though at that time, the snapshots didn't get consolidated.

I have downloaded the vmdk file(s), which made me end up with a server.vmdk and a server_delta.vmdk.
Is it possible to consolidate them externally?
Or, if i consolidate the Snapshots on the host, will the drive get consolidated too, even though it is removed?
I can't seem to reconnect it, i get the internal error: The object reference was not set to an object instance (or something similar, had to translate it).

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

What shoul work in this case is to:

  1. shutdown the VM
  2. edit the .vmx file, and set scsi0:1.present from "FALSE" to "TRUE"
  3. reload the VM ( see steps 2 and 3 from https://kb.vmware.com/s/article/1026043)

Please consider to take an additional snapshot prior to powering on the VM, so that the current files do not get modified in case we need to reverrt to the current state.

As a side note. Your VM runs with active snapshots since April 2016, and as you can see from the snapshot (delta) files' sizes, the snapshots consume quite some disk space.

André

View solution in original post

9 Replies
a_p_
Leadership
Leadership
Jump to solution

>>> which made me end up with a server.vmdk and a server_delta.vmdk.
You should actually have 4 .vmdk files, two small descriptor files, and two data files (flat/delta).
If that's not the case, then please post a complete listing (ls -lisa *.vmdk) of the VM's virtual disk files.

Attaching a snapshot to a VM may not work, but what should is to attach the base virtual disk, and then modify the VM's .vmx file. Please note that the VM has to be powered off for these steps!

  1. shut down VM
  2. add the existing virtual base disk (server.vmdk) to the VM.
  3. connect to the host via e.g. putty, or login from the console
  4. edit the VM's configuration (.vmx) file, and replace server.vmdk with server-000001.vmdk (the latest snapshot .vmdk)
  5. reload the VM ( see steps 2 and 3 from https://kb.vmware.com/s/article/1026043)

This should allow you to access the virtual disk including the deltas from the snapshot(s).
If you want to consolidate the snapshot, simply create a new VM snapshot, and then run "Delete All" from the Snapshot Manager.
I assume that you have sufficient free disk space on the datastore, in case that the virtual disk has been thin provisioned.

André

 

0 Kudos
FBC1
Contributor
Contributor
Jump to solution

Thank you for your answer!

When browsing the datastore with the vsphere client, i can find 3 vmdks, of which only two were connected:
570428932 330420224 -rw------- 1 root root 338346938368 Apr 8 15:37  server-000001-delta.vmdk
574623236 64 -rw------- 1 root root 342 Apr 26 2016                                  server-000001.vmdk
96472580 325062656 -rw------- 1 root root 429496729600 Apr 26 2016  server-flat.vmdk
100666884 64 -rw------- 1 root root 544 Nov 25 2013                                  server.vmdk
578817540 253857792 -rw------- 1 root root 259947237376 Apr 2 00:52  server_1-000001-delta.vmdk
583011844 64 -rw------- 1 root root 404 Apr 26 2016                                   server_1-000001.vmdk

Not sure what the normal server.vmdk is as it isnt connected and hasn't been ever since i took this job...
The server-000001.vmdk is disk 1, the server_1-000001.vmdk is disk 2 and also the disk in question.

When adding a new disk via the vsphere client, i can only choose the "base" disk (server_1-000001.vmdk), for which i get the error "The object reference was not set to an object instance". Am i supposed to add the "flat" and then the "base"? Or add the flat and replace it with the "base"?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Some virtual disk files are either missing, or stored in another folder.

Base disk 1: server.vmdk and server-flat.vmdk
Snapshot 1: server-000001.vmdk and server-000001-delta.vmdk

Base disk 2: server_1.vmdk and server_1-flat.vmdk (these files are missing)
Snapshot 1: server_1-000001.vmdk and server_1-000001-delta.vmdk

The file name used in the VM's configuration is always the descriptor file, i.e. the one without flat/delta in its name.

Please take a look at server_1-000001.vmdk, which should contain a "parentFileNameHint" which points to its base disk.
A snapshot is basically useless without its base disk.

André

0 Kudos
FBC1
Contributor
Contributor
Jump to solution

I hope using grep as described in this article is the correct approach. Got this output:

>grep -A2 parentFile server_1-000001.vmdk | grep -v "#"
>parentFileNameHint="/vmfs/volumes/502d0319-d59e4928-483b-003048c9ccd4/server/server_1.vmdk"
>RW 1073741824 VMFSSPARSE "server_1-000001-delta.vmdk"

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Accoding to the output, the base virtual disk is located on another datastore/folder, otherwise you'd only see the .vmdk name in the parentFileNameHint.

Please confirm that the file exists, and is not in use by another VM. You also want to verify that the snapshot's "parentCID" matches the base disk's "CID". If that is not the case, the base disk has been modified, and fixing the snapshot chain (i.e. setting the "parentCID" to the value of the "CID") may result in data corruption, or loss.

André

0 Kudos
FBC1
Contributor
Contributor
Jump to solution

Parent exists and ParentCID=base disk CID.
Also not in use by any other vm.
What's the next move?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Since this is not a usual situation, and I don't want take any risks, I'd like to ask you to provide:

  1. a complete file listing (ls -lisa > filelist.txt) of the VM's files
  2. the VM's configuration (.vmx) file

Please compress/zip the two files (filelist.txt and server.vmx), and attach the .zip archive to your next reply.

André

0 Kudos
FBC1
Contributor
Contributor
Jump to solution

Here you go. Keep in mind that the names are different here compared to my messages, as i tried to make it a bit clearer to read and understand.

The filelist_snaps.txt is the filelist from the "original" directory, where the rest of the files are. The normal filelist.txt is from the directory with the base vmdk.

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

What shoul work in this case is to:

  1. shutdown the VM
  2. edit the .vmx file, and set scsi0:1.present from "FALSE" to "TRUE"
  3. reload the VM ( see steps 2 and 3 from https://kb.vmware.com/s/article/1026043)

Please consider to take an additional snapshot prior to powering on the VM, so that the current files do not get modified in case we need to reverrt to the current state.

As a side note. Your VM runs with active snapshots since April 2016, and as you can see from the snapshot (delta) files' sizes, the snapshots consume quite some disk space.

André