2

In Linux I'm running Windows inside VMware Player. When I shut down Windows, VMware Player says the following:

enter image description here

How can the disk be fragmented if the host system is Linux? If I defragment the drive from within the Windows virtual machine is it the same thing as letting VMWare defragment it?

2 Answers 2

2

Here's what VMWare has to say about it:
http://www.vmware.com/support/ws55/doc/ws_disk_defrag.html.

2
  • 1
    That's a lot of steps for defragmenting. Why would you have to defrag inside the VM if you can already defrag it outside of it from VMWare? I didn't defrag the disk inside the VM just from VMWare and the message doesn't show up anymore.
    – tony_sid
    Commented Aug 8, 2010 at 14:52
  • 1
    The VMWare virtual disk is a physical file on your physical hard disk, and as such that file can be physically fragmented. However, from the point of view of the guest OS, that physical fragmentation is invisible. All it can see is what appears to be a physical disk but is in fact one chunk of data. As the virtual disk is used and files in that disk are moved around, the placement of files within that virtual disk becomes less efficient; hence the need to defragment it. The point is that the placement of files within each of the physical and virtual disks is invisible to the other.
    – boot13
    Commented Aug 8, 2010 at 15:16
-1

Linux filesystems can get fragmented, just usually less dramatically. ext4 has an online defragmentation tool, but I do not remember what it is called and unless I know your distro, I wouldn't know what package it would be in. If your virtual disk is set to expanding rather than fixed size, no filesystem is going to keep it from becoming fragmented unless it's on its own separate partition, which of course defeats the purpose of using an expanding virtual disk.

I say do just as that screenshot says, but I suggest throwing in a few extra steps.

  1. Boot the VM, then defragment the boot drive. I suggest using Defraggler since it is a lot more thorough than the one built-in to Windows. Just don't install the Yahoo toolbar it offers, I've seen that darn toolbar break IE more times than I can count. ** If you want to be really thorough, remove the pagefile and use msconfig to boot the VM into diagnostic mode (not safe mode). Then defragment, re-enable the pagefile, use msconfig to bring it back to normal startup, then reboot.
  2. Open VMware tools in the VM and shrink the boot disk. (If VMware Tools aren't installed, use google to find sdelete.exe, which will be on Microsoft's website. Open a cmd window and run sdelete C: -c) After it prepares to shrink your disk, it might ask if you want to shrink it now. Go ahead and say no, then shut down.
  3. In the Virtual Machine's settings, select the disk, then click "Shrink". Wait for that to finish, then click "Defragment". This will just move the disk file to the next available contiguous space large enough to fit it. The shrink in the steps above make it smaller to help it find a good spot where it'll stay in the fewest number of fragments as long as possible.
2
  • 1
    I don't think it's because the linux filesystem is fragmented. The disk size is fixed.
    – tony_sid
    Commented Aug 8, 2010 at 6:47
  • That is odd. A fixed-size disk shouldn't become fragmented. The only way it would be fragmented is if it was created on or moved to a very heavily-fragmented volume. Like I said, ext3 and ext4 can become fragmented, but its usually very mild. Go ahead and try defragmenting the disk from inside the VM then click the defragment button in the VM's options. But skip all the shrinking instructions. Perhaps look up your distribution, filesystem, and "online defragmentation" to see if your distribution has a tool to check for any fragmentation.
    – TuxRug
    Commented Aug 8, 2010 at 22:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .