VMware Communities
Mongo424242
Enthusiast
Enthusiast
Jump to solution

Defragging Guest vs Host and Snapshots

Hi all,

Quick question.  Even though I have been using VMs for years (starting with Virtual Box, and now VMWare), I am still a beginner (to put it lightly).  I have been using multpile VMs on a Ubuntu host for some time, and have been "maintaining" them by degfraging first from inside the guest, and then from the VMWare utility.  I have also been taking a few snapshots along the way (like when I install something, and want the ability to go back if there is a problem).  After reading from the KB, my understanding is that when I defrag from inside the guest after a snapshot, the moved blocks are written to a difference file instead of the main disk.  My question is, if I were to sequentially delete the snapshots, doesn't that add the info from the difference file back to the main disk?  Each deletion merges the difference file with the current state, correct?  So, if I were to delete all of the snapshots starting with the most recent and working backwards, would I get back to where I started (albeit with a current disk), and get my performance back?  Thanks!

Mongo

Reply
0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

What about taking a snapshot, cloning the snapshot immediately after, and then deleting the original machine?  Would that be the same thing as never having made the snapshots in the first place?

Yes, assuming that you create a full clone (i.e. not a linked clone) this will have the same effect, because all snapshots will be merged into the full clone's new virtual disk. The only thing to remember is that the VM will get a new UUDI, and MAC address, in case this matters.

André

View solution in original post

Reply
0 Kudos
5 Replies
a_p_
Leadership
Leadership
Jump to solution

Deframentation with existing snapshots writes the changed blocks to a delta file (as you already mentioned). The more delta files, the more .vmdk files are in use with the VM. Depending on your backing device (HDD, SSD) this may result in degraded performance.

Deleting a snapshot, will merge the changed blocks into its parent .vmdk file(s), so I'd suggest you either delete all snapshots, or you start deleting with the oldest snapshot, i.e. the one for which the changed blocks will be merged into the base .vmdk file.

KB Article https://kb.vmware.com/s/article/1015180 may help to understand this better.


André

Reply
0 Kudos
Mongo424242
Enthusiast
Enthusiast
Jump to solution

Hi a.p.

Thank you for the links, as I am starting to understand a little more about VMs (in a while, I might even be dangerous).  What about taking a snapshot, cloning the snapshot immediately after, and then deleting the original machine?  Would that be the same thing as never having made the snapshots in the first place?  As I understand it, the clone would simply be an independent VM identical to specified snapshot (which would be the current state), without any of the interim snapshots, or am I barking up the wrong tree?  Thanks!

Mongo

Reply
0 Kudos
wila
Immortal
Immortal
Jump to solution

Hi,

FYI this answer by one of the VMware engineers has been the best explanation about fragmentation I've ever seen:

vmware player - Will fragmentation of a virtual machine's disk also cause host OS disk fragmentation...

Note that defragmenting within the guest after a snapshot basically has the opposite effect of what you want, it won't speed things up, instead it will be more slow.

Committing your snapshots before a defrag in the guest is the only time when that makes sense to run an in guest defragmentation.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
a_p_
Leadership
Leadership
Jump to solution

What about taking a snapshot, cloning the snapshot immediately after, and then deleting the original machine?  Would that be the same thing as never having made the snapshots in the first place?

Yes, assuming that you create a full clone (i.e. not a linked clone) this will have the same effect, because all snapshots will be merged into the full clone's new virtual disk. The only thing to remember is that the VM will get a new UUDI, and MAC address, in case this matters.

André

Reply
0 Kudos
Mongo424242
Enthusiast
Enthusiast
Jump to solution

Thank you all!

Reply
0 Kudos