+ Post New Thread
Results 1 to 4 of 4
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 ...
  1. #1
    Jobos's Avatar
    Join Date
    Apr 2007
    Posts
    1,101
    Thank Post
    171
    Thanked 44 Times in 37 Posts
    Rep Power
    23

    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.

  2. #2

    jinnantonnixx's Avatar
    Join Date
    Mar 2011
    Location
    In the Calamatorium.
    Posts
    1,826
    Thank Post
    104
    Thanked 449 Times in 308 Posts
    Blog Entries
    2
    Rep Power
    262
    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:
    http://blogs.vmware.com/vsphere/2011...-guest-os.html


    http://kb.vmware.com/selfservice/mic...rnalId=1006810
    Last edited by jinnantonnixx; 16th November 2012 at 10:25 AM.

  3. #3

    Join Date
    Mar 2011
    Location
    Bournemouth
    Posts
    280
    Thank Post
    16
    Thanked 74 Times in 64 Posts
    Rep Power
    21
    Quote Originally Posted by jinnantonnixx View Post
    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...
    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.

    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.

  4. #4

    jinnantonnixx's Avatar
    Join Date
    Mar 2011
    Location
    In the Calamatorium.
    Posts
    1,826
    Thank Post
    104
    Thanked 449 Times in 308 Posts
    Blog Entries
    2
    Rep Power
    262
    More:
    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.
    That's clear on the SAN front...

    Turning to the guest's NTFS filesystem...
    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
    So this would imply that a defrag has significant benefits for the Window's file system.

    I'm climbing back on the fence.
    Last edited by jinnantonnixx; 16th November 2012 at 11:44 AM.

SHARE:
+ Post New Thread

Similar Threads

  1. Quick Moodle question
    By kennysarmy in forum Virtual Learning Platforms
    Replies: 12
    Last Post: 7th July 2012, 12:07 AM
  2. quick pgbackground question
    By mossj in forum EduGeek Joomla 1.5 Package
    Replies: 3
    Last Post: 7th January 2009, 07:34 PM
  3. Quick ePortal question - Serco Facility
    By cheredenine in forum MIS Systems
    Replies: 0
    Last Post: 14th July 2008, 03:20 PM
  4. Quick PSU question
    By sidewinder in forum Hardware
    Replies: 3
    Last Post: 12th February 2008, 12:19 PM
  5. Quick WSUS Question
    By mattx in forum Windows
    Replies: 3
    Last Post: 10th May 2007, 03:14 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •