VMware Cloud Community
mhdganji
Enthusiast
Enthusiast
Jump to solution

Reverting to all snapshots !

Hi !

maybe this question is because i am wrong with snapshot concept. please help me to understand it

assuming i have a 40 GB virtual disk (it contains 40GB of data)

and i make a snapshot from that

my assumption is that in this snapshot, the vmdk file (40GB) is put away and future changes (from now on) will be written in another file. another snapshot and the same story again.

if it is not the case, for every single snapshot, disk size equal to vm disk size should be available and written which  does not seem good.

and if my assumption is right, there is another problem.

assuming we have a disk (40gb) and a snapshot is taken

ok 40gb disk is put away and another file is created for future writings (we write to disk 100 mg more) snapshot 1

another snapshots will be taken. so another 100 mb file will be put aside and changes are stored from now on in another file snapshot 2

and ...

but if it is ok, the snapshots between should not be deleted , for example we can not delete snapshot 1 because in that case we cant revert to snapshot 2 (100mb of changes was in snapshot1)

but as i remember, we can delete any snapshot we like.

so i am confused here please help with that

Thanks

0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

Snapshots in VMware products work like a chain (see http://kb.vmware.com/kb/1015180) As soon as you create a snapshot, all changes will only be written to the new snapshot vmdk and the parent .vmdk will only be accessed read-only. When you delete a snapshot, the data in this snapshot .vmdk file will be written/merged to its direct parent .vmdk.

Example: 40GB .vmdk -> Snapshot 1 (100MB) -> Snapshot 2 (200 MB) -> Snapshot 3 (100 MB)

In this case changes are only written to Snapshot 3, however blocks will be read from the .vmdk file which holds the latest changes for this data block. If you delete Snapshot 2 in the above example, its data will be merged into the .vmdk file of Snapshot 1 and you will not be able to revert to Snapshot 2 anymore (obviously).

André

View solution in original post

0 Kudos
7 Replies
Shakaal
Hot Shot
Hot Shot
Jump to solution

Hi

Folllowing KB article will give you more indepth on snapshots

http://kb.vmware.com/k1015180

deleting snapshot 1, will merge the data to snapshot2, also you can revert to snapshot 2, in this case all the changes made to snapshot 2 will be lost.

Regards

a_p_
Leadership
Leadership
Jump to solution

Snapshots in VMware products work like a chain (see http://kb.vmware.com/kb/1015180) As soon as you create a snapshot, all changes will only be written to the new snapshot vmdk and the parent .vmdk will only be accessed read-only. When you delete a snapshot, the data in this snapshot .vmdk file will be written/merged to its direct parent .vmdk.

Example: 40GB .vmdk -> Snapshot 1 (100MB) -> Snapshot 2 (200 MB) -> Snapshot 3 (100 MB)

In this case changes are only written to Snapshot 3, however blocks will be read from the .vmdk file which holds the latest changes for this data block. If you delete Snapshot 2 in the above example, its data will be merged into the .vmdk file of Snapshot 1 and you will not be able to revert to Snapshot 2 anymore (obviously).

André

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

@Shakaal

deleting snapshot 1, will merge the data to snapshot2

Actually, it's the other way around. Deleting Snapshot 1 will merge the data to its parent virtual disk, the base disk!

André

0 Kudos
mhdganji
Enthusiast
Enthusiast
Jump to solution

So, the key concept here is chaining and not actually deleting a snapshot file

so if i am well understood, in this scenario :

first disk (500mb)

snapshot

..... 50 mb

snapshot

...150mb

snapshot

if we delete second snapshot its data will be merged to its parent and make it 550 mb

and if this is the way it works, snapshots will be always with us and total size of our vm will be first size plus all changes.

and another matter, if we delete last snapshot, it will be merged too ? for example if snapshot 3 is deleted, its data is merged to second ?

i think it will not be merged since when i delete the last one, it means that i dont need it anymore and also there are no snapshots further (which are dependent to this) so it can be deleted completely. am i right here ?

and can u give me a brief description about committing snapshots? i had one vm whose snapshots had made host to generate redo log or disk full or such errors.

and last of all, if i take snapshot from a 40gb thick disk (which is 20GB full), will the read only vmdk file be 20GB or 40GB ?

are these sizes (thin or thick) total allowd size including snapshots ?

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

First of all there seems to be confusion with the wording. "Deleting" a snapshot actually means merging/committing the data from the snapshot .vmdk file into the parent .vmdk file. "Reverting" to a snapshot means you will discard any changes and basically reset the VM to the state of the snapshot when it was created.

if we delete second snapshot its data will be merged to its parent and make it 550 mb

It depends. As you can see in the image from the KB article I mentioned, deltas are written to the snapshot files. Assuming you already have data in block 20 on the base disk and you modify them, block 20 will be written to the snapshot file with its new contents. Once the snapshot is deleted, this block will overwrite the existing block 20 and not consume additional disk space. Only blocks which do not already exist in the base disk will require additional disk space.

1887763.png

and another matter, if we delete last snapshot, it will be merged too ?  for example if snapshot 3 is deleted, its data is merged to second ?

As mentioned above. Deleting a snapshot will merge its data to the parent virtual disk.

Each snapshot can grow up to the "configured" size of the base disk (plus some overhead). The snapshot contains data blocks which map to the according block in the base disk. It may contain blocks which already exist in the base disk as well as new blocks which don't exist in the base disk.

and last of all, if i take snapshot from a 40gb thick disk (which is 20GB full), will the read only vmdk file be 20GB or 40GB ?

For a thick (full provisioned) disk, the size won't change if you take a snapshot. Only the snapshot will grow (up to ~40GB in your example). When you delete the snapshot, the base disk will not grow either since all data blocks were already allocated in it.

André

0 Kudos
mhdganji
Enthusiast
Enthusiast
Jump to solution

so i took some lab test and this is the result and my question about them.

i created a thin disk machine and installed a win 2k8 r2 on that. as you can see the size is about 18 GB (First File named

remoteapp.vmdk)

i created a snapshot of that and changed the machine very little (just changing background and some like that)

and then another snapshot.

but as you see a vswp file and also two vmsn files with size of approximately 4GB are created. ! what are these? we said that

when the snapshot is made, the main and basic vmdk file is marked read only and put away and a snapshot file is

created which its size will grow up with changes we make. but the first one is 4GB and even the next one (with little changes in machine)

is also 4 GB. can you please explain that to me

sn1.JPG

also a question here. when i browse the vm directory using scp, the vmdk file is shown 40 GB not 18 GB. ! what does this mean,

who is telling the truth ?

and also what is the 51 GB vms file here (vmx-remoteapp-367..)

sn2.JPG

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

but as you see a vswp file and also two vmsn files with size of approximately 4GB are created. ! what are these?

To be able to revert to a the VM's state at the time the snapshot was created, it is necessary to capture the VM's current state (e.g. memory, registers, ...). These .vmsn (Virtual Machine SNapsot state) files are only created if you take a snapshot with the virtual machine powered on.

the vmdk file is shown 40 GB not 18 GB. ! what does this mean, who is telling the truth ?

Both - the datastore browser as well as scp - are telling the truth. Thin provisioning is a feature of the file system and therefore tools like scp (which are not aware of this) will always show the full provisioned disk size rather than the current disk space usage. If you would download this file to your desktop, you would end up with the full size, sine your desktop does not support thin provisioning. Since the datastore browser is aware of thin provisioning, it shows the current disk usage in addition to the provisioned size.

and also what is the 51 GB vms file here (vmx-remoteapp-367..)

Please provide the full name of the file including the file extension. Btw, it's 51MB, not 51GB.

André