Is ok to do a disk defrag?

Discussion in 'Parallels Desktop for Mac' started by dorian88, Mar 27, 2007.

  1. dorian88

    dorian88 Member

    Messages:
    47
    Hello,

    Can I do things like perform a disk defrag and disk clean up on the windows running on parallels? I am just wondering because the program is technically running on the mac osx disc and didn't want it to screw it up.

    Thanks.

    Dorian
     
  2. Eru Ithildur

    Eru Ithildur Forum Maven

    Messages:
    1,954
    Yes.

    You sure can... I do it all the time. In fact, I would recommend it.

    Most of the time though, I have tested this with BootCamp partitions, but from inside of Parallels... But, I did use it a few times on regular .hdd drives without an issue.

    But, as usual, in doubt, back-up.
     
    Last edited: Mar 27, 2007
  3. ajay

    ajay Hunter

    Messages:
    153
    I do disk cleanups and defrags frequently in my Winxp Guest OS in Parallels. I believe it keeps things healthy. It has never been the cause of any of my problems.
     
  4. mmischke

    mmischke Hunter

    Messages:
    155
    A defrag isn't so straightforward when dealing with VMs (regardless of vendor). When you defrag a guest OS you fragment the virtual disk file on the host OS. When you defrag the host OS you defeat the defrag of the guest environment. Here's how I defrag XP running under Parallels on my Mac mini:

    1) Defrag XP using your favorite tool or the built-in defragger.

    2) Move the disk image from the external drive to another disk and copy it back.

    I do this once a week. Now I have a defragged guest OS and a contiguous virtual disk image, courtesy of the copy operation. What we virtualization fans need is someone to step in and develop a defragmentation tool which takes both guest and host OSs into account in one pass. This would be especially important for those running virtualized sevrer environments.

    Fragmentation is often overlooked on OS X because HFS+ is generally considered frag-resistant. This is only true to a degree. OS X defrags files as they're opened, but only up to a certain size (much less than the file size of a virtual disk image). Our virtual drives become easily fragmented on OS X without manual intervention.
     
  5. David5000

    David5000 Pro

    Messages:
    312
    Thank you for these tips.

    Sorry for the basic question, but when you say disk image, do you mean the winxp.hdd file? Also, when you say to move the disk image from the external drive, do you mean to move it first to an external drive and then back again?

    David
     
  6. Eru Ithildur

    Eru Ithildur Forum Maven

    Messages:
    1,954
    Yes, if you are using Parallels without BootCamp.

    If you are using BootCamp, it will not be an issue as you can typically select between Partitions.
     
  7. David5000

    David5000 Pro

    Messages:
    312
    Whose post are you answering? (Not quoting the post you are referring to leaves it a little ambiguous.)

    Thank you,

    David
     
  8. Eru Ithildur

    Eru Ithildur Forum Maven

    Messages:
    1,954
    Werps. Meant to respond to his question about your post... Sorry about that.

    Basically, I was referring to what you need to back-up and remove from your drive in the two different scenarios.
     
  9. David5000

    David5000 Pro

    Messages:
    312
    Sorry to be so dense, but who are you referring to in "his question" and "your post?"

    Quoting the post you are referring to would go a long way to making things clear.

    Thank you,

    David
     
  10. Eru Ithildur

    Eru Ithildur Forum Maven

    Messages:
    1,954
    *laughs* David, I replied to your question with yet another circular answer. Sometimes I act like a screwball. Sorry.

    Yes, if you are using Parallels without BootCamp. He is recommending that you remove it so that your OS X does not duplicate effort. You move it to an external, delete it, defragment your internal disc, and then drop the backed-up image back onto the internal.

    Although, if you are using Parallels pointing at a BootCamp partition, it will not be an issue as you can typically select between Partitions when you defragment, so you can just defragment in whatever manner you want..

    Let me know if is I was finally intelligable or if I should go back to preschool. :D
     
  11. David5000

    David5000 Pro

    Messages:
    312
    When mmischke refers to "disk image," does he mean the winxp.hdd file? Is that what he is recommending you remove?

    David
     
  12. Eru Ithildur

    Eru Ithildur Forum Maven

    Messages:
    1,954
    Yes, I do believe so. That is the only thing I can think of that it could mean.
     
  13. David5000

    David5000 Pro

    Messages:
    312
    Thank you--now I understand. That was my original question.

    David
     
  14. wesley

    wesley Pro

    Messages:
    396
    If the disk image is the 'fixed' type, the file itself will just 'stay' in one spot while defragmenting within the VM. Therefore no moving in and out is necessary, IMO.
     
  15. David5000

    David5000 Pro

    Messages:
    312
    Let me make sure I have this right. When defragmenting a non-Boot Camp, XP Pro VM, are these the steps?

    1. Defragment the VM from within Windows
    2. Copy the VM to an external drive
    3. Delete the VM from the internal Mac drive
    4. Defragment the internal Mac drive
    5. Copy the VM from the external drive back to the internal drive

    David
     
  16. mmischke

    mmischke Hunter

    Messages:
    155
    Sorry that I lost track of this thread. :-(

    @David5000: Yes, I meant copying the physical .hdd file elsewhere and then back again. Eru is quite correct about this being unnecessary when running Parallels from a Boot Camp partition. A defrag there means a defrag of a physical partition.

    @Wesley: I fully agree about fixed-size virtual disks. That's been my operational assumption all along (fingers crossed) and it's why I use one myself. Since these images are just files which have already been allocated on the host FS, we're only altering data in the file's already-allocated sectors (assuming that Parallels, etc. works this way under the hood). I view the 'fragmentation catch-22' problem to be isolated to those who use expandable VMs, which may possibly represent the bulk of VM users (just a guess).

    @David5000: The five steps which you've outlined describe the exact process I use weekly. And... after reviewing the comments on this thread it would appear that I don't need to bother with the copy/copy back step, since I have a fixed-size VM (only file on an external drive). I guess I was over-compensating. ;-)

    Again, sorry for dropping the ball on this one...
     
  17. dkp

    dkp Forum Maven

    Messages:
    1,367
    I would:

    * Shut down the VM
    * Copy the VM directory structure to an external disk
    * Delete the original VM directory structure - caution: be sure your copy is complete and viable.
    * Defrag the OS X disk that contained your VM
    * Copy the VM disk structure back to where it came from
    * Start the VM then use that OS's defrag tool to defrag it's filespace
    * You now have a defrag'd host supporting a defrag'd guest

    At this point you can repeat the first two steps so that you have a clean, defrag'd VM backup of your running VM to use should the original become corrupt.

    This procedure will ensure you have a defrag'd version of your VM running in contiguous OS X file space. The idea is to avoid having a fragmented VM file system residing on a fragmented OS X file system. If the VM never changes size it should never again be necessary to defrag in stages like this. You'd just defrag the VM.
     
  18. David5000

    David5000 Pro

    Messages:
    312
    A couple of questions:

    1. Where is the VM directory structure located?
    2. Does it make a difference to copy only that vs. the entire Parallels folder in ~Users/Libary?
    3. Wouldn't it be better to defragment the VM before copying it to an external disk?
    4. I am using a dynamically expanding, not fixed-size VM--does this mean I always to defragment in stages, as you put it?

    David
     
  19. wesley

    wesley Pro

    Messages:
    396
    1. By default, ~/Documents/Parallels
    2. All VM-specific items reside in the folder above and thus stuff in ~/Library/Parallels is irrelevant here.
    3. No, because the disk file in question suffers double fragmentation - the inside of the disk file is fragmented and the disk file itself is fragmented. Trying to defrag the inside while the file itself is fragmented would be slower than having to defrag inside after the file itself is defragmented.
    4. For best possible performance, yes.
     
  20. dkp

    dkp Forum Maven

    Messages:
    1,367
    What he said. It's very correct.
     

Share This Page