Windows Server 2008 R2 Thread, Quick defrag question in Technical; Is it safe to defrag a virtual machine? Google gives mixed advice on the subject and my virtual machine (server ...
16th November 2012, 10:58 AM #1
Quick defrag question
Is it safe to defrag a virtual machine? Google gives mixed advice on the subject and my virtual machine (server 2008r2) is running at 21% fragmented which must be slowing it down.
16th November 2012, 11:06 AM #2
I wouldn't bother. You're looking at fragmentation on a file system which is wrapped up in another file system (which itself may or may not be fragmented). You might get a benefit if you're using RDM, but the fragmentation could cause the SAN controller to look for other parts on a separate disk which could improve performance! Add file caching (guest OS + host OS) to the equation...
Edit: to actually answer the question, yes it is safe.
This post is more authoritative than my answer:
Last edited by jinnantonnixx; 16th November 2012 at 11:25 AM.
16th November 2012, 12:21 PM #3
I disagree with this actually, esx's file system has features which prevent any meaningful fragmentation, and given that the datastore will be distributed accross multiple disks in a structured and optimised way by any san, i find it hardly likely that random fragmentation on a guest partition would improve upon that.
Originally Posted by jinnantonnixx
Plus the latest versions of esx use a 1MB block size in their datastore, which means that data is read in 1MB blocks regardless of the physcial block sizes.
I would say that at worst it wont make any difference, but it could definitely still give performance gains.
The only thing I would say is that a defrag operation would obviously taint any ssd or memory cache in your san which could potentially temporarily reduce the performance of a live system, but unless you system is running flat out I doubt anyone would notice.
16th November 2012, 12:33 PM #4
That's clear on the SAN front...
SAN technology abstracts physical disk from the server. This is well known and understood: the ESX doesn’t talk to the disks, it talks to the cache on the frame, thus a defrag operation (take block at location A and move to location B) doesn’t really “move” the block, as the cache deals with that, so defrag will not have any benefits at the SAN layer. Additionally, by its nature, vmware will always be pure random IO from the frame’s perspective, and defrag can’t gain us anything there either.
Turning to the guest's NTFS filesystem...
So this would imply that a defrag has significant benefits for the Window's file system.
how things are from the NTFS point of view in the guest OS. This is a HUGE consideration. Every file location on NTFS volume is tracked in the MFT (master file table). The MFT is a flat linear file and 1024 bytes is allocated per MFT entry that holds file attributes and extent data which describes each extent that a file sits on in the file system. An extent in this context is defined as a series of contiguous NTFS clusters (blocks). A contiguous file has one extent entry, essentially “Starting offset and length”. A fragmented file can have many extent entries. Additionally a heavily fragmented file may fill up the 1024 bytes for its MFT table entry and it would have to append a new MFT entry to continue with the extent descriptors. Remember I said it’s a linear table, thus it can only be placed at the end of the MFT. Now lets take the fragmentation to extreme and the MFT reserved space fills up? The system will start taking free space blocks and reserving IT for the MFT, now the MFT itself is fragmented. So instead of the guest OS issuing two reads (one for the MFT table entry and one for the actual data), it would have to do multiple reads just to get the MFT and then many more additional reads to read in each extent. Now multiply this times the quantity of systems chattering down the same FC channel to the VMFS and you quickly have performance degradation
I'm climbing back on the fence.
Last edited by jinnantonnixx; 16th November 2012 at 12:44 PM.
By kennysarmy in forum Virtual Learning Platforms
Last Post: 7th July 2012, 01:07 AM
By mossj in forum EduGeek Joomla 1.5 Package
Last Post: 7th January 2009, 08:34 PM
By cheredenine in forum MIS Systems
Last Post: 14th July 2008, 04:20 PM
By sidewinder in forum Hardware
Last Post: 12th February 2008, 01:19 PM
By mattx in forum Windows
Last Post: 10th May 2007, 04:14 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)