Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

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.
share|improve this answer
1  
I don't think it's because the linux filesystem is fragmented. The disk size is fixed. –  tony_sid Aug 8 '10 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 Aug 8 '10 at 22:50
add comment

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

share|improve this answer
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 Aug 8 '10 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 Aug 8 '10 at 15:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.