• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Defrag inside a VM. Would there be any point?

#1
Would it help a VM if you were to run Defrag inside it? It's only a
virtual hard drive, but presumably it has the potential to fragment
itself within.
 

My Computer

M

Mark Rae [MVP]

#2
"d d" <go_on_try_and_sp@xxxxxx_me.com> wrote in message
news:O3NHG%233RJHA.1164@xxxxxx

> Would it help a VM if you were to run Defrag inside it?
As much as it would help any other machine, whether physical or virtual...

> It's only a virtual hard drive,
Not as far as the operating system running on it is concerned, which has not
the slightest idea that it's running in a virtual machine...

> but presumably it has the potential to fragment itself within.
Correct.


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
 

My Computer

#3
Mark Rae [MVP] wrote:

> "d d" <go_on_try_and_sp@xxxxxx_me.com> wrote in message
> news:O3NHG%233RJHA.1164@xxxxxx
>

>> Would it help a VM if you were to run Defrag inside it?
>
> As much as it would help any other machine, whether physical or virtual...
>

>> It's only a virtual hard drive,
>
> Not as far as the operating system running on it is concerned, which has
> not the slightest idea that it's running in a virtual machine...
>

>> but presumably it has the potential to fragment itself within.
>
> Correct.
Thanks Mark. I thought it would help but considered there might be some
reason I'd overlooked why it would be a ridiculous idea :-)
 

My Computer

M

Mark Rae [MVP]

#4
"d d" <go_on_try_and_sp@xxxxxx_me.com> wrote in message
news:%23ZuM%23K4RJHA.4680@xxxxxx

> Thanks Mark. I thought it would help but considered there might be some
> reason I'd overlooked why it would be a ridiculous idea :-)
Generally speaking, whenever you have a VPC question, the answer is almost
always "what if this were a physical machine?". As mentioned, the software
(both operating system and applications) you install on a VM has not the
slightest idea that it's not running on a physical machine - it has no need
to know this, because it makes absolutely no difference.

Just consider every virtual machine as functionally equivalent to a
low-specification physical machine, and you'll not go far wrong.

Also: http://vpc.visualwin.com/ngfaq.aspx


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
 

My Computer

R

Richard Urban

#5
If you do a lot of install/uninstall of programs for testing purposes the VM
(physical size on disk) seems to grow in size. To solve for this condition
you need to empty the recycle bin (or use CCleaner to get out the crud) and
then defragment. You can then prepare the VM for compaction (use the virtual
disk precompactor from with VM Additions).

After you close down the VM you can use the Virtual Disk Wizard to compact
the VM. I have seen the physical size of the VM decrease by 2-4 gig in
physical size and the aftermath is that the VM seems a bit more responsive
when I again use that particular VM.

--

Richard Urban
Microsoft MVP
Windows Desktop Experience


"d d" <go_on_try_and_sp@xxxxxx_me.com> wrote in message
news:O3NHG%233RJHA.1164@xxxxxx

> Would it help a VM if you were to run Defrag inside it? It's only a
> virtual hard drive, but presumably it has the potential to fragment itself
> within.
 

My Computer

D

DevilsPGD

#6
In message <#6xpEh4RJHA.2268@xxxxxx> "Mark Rae [MVP]"
<mark@xxxxxx> was claimed to have wrote:

>"d d" <go_on_try_and_sp@xxxxxx_me.com> wrote in message
>news:%23ZuM%23K4RJHA.4680@xxxxxx
>

>> Thanks Mark. I thought it would help but considered there might be some
>> reason I'd overlooked why it would be a ridiculous idea :-)
>
>Generally speaking, whenever you have a VPC question, the answer is almost
>always "what if this were a physical machine?". As mentioned, the software
>(both operating system and applications) you install on a VM has not the
>slightest idea that it's not running on a physical machine - it has no need
>to know this, because it makes absolutely no difference.
>
>Just consider every virtual machine as functionally equivalent to a
>low-specification physical machine, and you'll not go far wrong.
True, but there is a little more to the defragmentation picture.
Defragmenting in the guest alone is worthless if the VHD file on the
host is fragmented as the physical heads will still need to seek for a
consecutive read.

To have an effect you must defragment within the guest first, then if
you're using an expanding VHD rather then a fixed size compact, then
finally defragment at least that one VHD file if not the entire drive.

As much as many questions start with "what if this were a physical
machine", you have to remember that you're combining the limitations of
the physical machine with the overhead of a virtual environment.

That being said, I would highly recommend defragmenting VMs, the
performance improvement can be staggering especially if you're on a
slower hard drive (a laptop, for example)
 

My Computer

M

Melelina

#7
"d d" <go_on_try_and_sp@xxxxxx_me.com> wrote in message
news:O3NHG%233RJHA.1164@xxxxxx

> Would it help a VM if you were to run Defrag inside it? It's only a
> virtual hard drive, but presumably it has the potential to fragment itself
> within.
It doesn't know that it is a virtual machine so, of course, it needs
defragging. I didn't realize though that VPC won't tell you when to defrag?
VMWare Workstation pops up a notice when you need to defrag. XP only needs
defragging about two-three times a year and I would assume Vista is about
the same. (Nothing like 98SE)!
 

My Computer

M

Mark Rae [MVP]

#8
"DevilsPGD" <spam_narf_spam@xxxxxx> wrote in message
news:t461i4dio980l66ufjtjgmvc7l9uj8khqd@xxxxxx

>> Just consider every virtual machine as functionally equivalent to a
>> low-specification physical machine, and you'll not go far wrong.
>
> True, but there is a little more to the defragmentation picture.
> Defragmenting in the guest alone is worthless if the VHD file on the
> host is fragmented as the physical heads will still need to seek for a
> consecutive read.
I took that as read. Surely everyone defragments their host machine on a
regular basis, no...?

> To have an effect you must defragment within the guest first, then if
> you're using an expanding VHD rather then a fixed size compact, then
> finally defragment at least that one VHD file if not the entire drive.
Obviously.

> As much as many questions start with "what if this were a physical
> machine", you have to remember that you're combining the limitations of
> the physical machine with the overhead of a virtual environment.
Indeed.

> That being said, I would highly recommend defragmenting VMs, the
> performance improvement can be staggering especially if you're on a
> slower hard drive (a laptop, for example)
Glad to hear it...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
 

My Computer

D

DevilsPGD

#9
In message <uz7btzESJHA.4772@xxxxxx> "Mark Rae [MVP]"
<mark@xxxxxx> was claimed to have wrote:

>"DevilsPGD" <spam_narf_spam@xxxxxx> wrote in message
>news:t461i4dio980l66ufjtjgmvc7l9uj8khqd@xxxxxx
>

>>> Just consider every virtual machine as functionally equivalent to a
>>> low-specification physical machine, and you'll not go far wrong.
>>
>> True, but there is a little more to the defragmentation picture.
>> Defragmenting in the guest alone is worthless if the VHD file on the
>> host is fragmented as the physical heads will still need to seek for a
>> consecutive read.
>
>I took that as read. Surely everyone defragments their host machine on a
>regular basis, no...?
Prior to Vista, no, at least not if my consulting experience is of any
indicator. You'll get a few whiz kid types that like to maintain their
own systems and defragment compulsively, a few that remember they're
supposed to defragment but don't get around to it more then a handful of
times per year and the rest probably don't bother at all.

Vista defragments automatically, which is a step in the right direction.

To see how poorly defragmenting is understood just look around at less
technical forums where defragmenting seems to be understood to be less
about performance, instead you'll see "you should defragment in the
future to avoid this" coming up in response to problems that are solved
using chkdsk or even are as a result of bad hardware.

>> To have an effect you must defragment within the guest first, then if
>> you're using an expanding VHD rather then a fixed size compact, then
>> finally defragment at least that one VHD file if not the entire drive.
>
>Obviously.
Well, obvious if you know how VHDs work. Of course those who know much
about the internal structure of a VHD probably know the answer to the
original question that started this thread anyway.

The reason I mention compacting too is that without compacting,
defragmenting inside the guest and in the host still results in
fragmentation internal to the VHD. If the goal is to defragment you
really need to perform all three steps and so far this thread had only
really discussed defragmenting within the VM itself, which is the first
step, but a borderline useless step on it's own.
 

My Computer

B

Bo Berglund

#10
On Sun, 16 Nov 2008 14:26:26 -0800, DevilsPGD
<spam_narf_spam@xxxxxx> wrote:

>To have an effect you must defragment within the guest first, then if
>you're using an expanding VHD rather then a fixed size compact, then
>finally defragment at least that one VHD file if not the entire drive.
How do you defragment a single file?
I have never seen that option in the Windows defragmenter.

--

Bo Berglund (Sweden)
 

My Computer

D

DevilsPGD

#11
In message <ps22i45p3p1q7tpj2f9hgsr4mlmi82npu2@xxxxxx> Bo Berglund
<boberglund@xxxxxx> was claimed to have wrote:

>On Sun, 16 Nov 2008 14:26:26 -0800, DevilsPGD
><spam_narf_spam@xxxxxx> wrote:
>

>>To have an effect you must defragment within the guest first, then if
>>you're using an expanding VHD rather then a fixed size compact, then
>>finally defragment at least that one VHD file if not the entire drive.
>
>How do you defragment a single file?
>I have never seen that option in the Windows defragmenter.
Windows' defragmenter doesn't do it, but Contig does:

http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx
 

My Computer

#12
Richard Urban wrote:

> If you do a lot of install/uninstall of programs for testing purposes
> the VM (physical size on disk) seems to grow in size. To solve for this
> condition you need to empty the recycle bin (or use CCleaner to get out
> the crud) and then defragment. You can then prepare the VM for
> compaction (use the virtual disk precompactor from with VM Additions).
>
> After you close down the VM you can use the Virtual Disk Wizard to
> compact the VM. I have seen the physical size of the VM decrease by 2-4
> gig in physical size and the aftermath is that the VM seems a bit more
> responsive when I again use that particular VM.
Thanks. Good tips.

So I think I've formulated a good plan:

1. Delete temporary files and windows update temp files etc to generally
clean up.

2. Empty recycle bin.

3. Defrag inside the VM.

4. Run the pre-compactor and close the VM.

5. Run the Compactor.

6. Run Contig on the VHD.

At the end of that I'll have a defragged, compacted smaller file and it
will be contiguous on the drive.
 

My Computer

M

Mark Rae [MVP]

#13
"d d" <go_on_try_and_sp@xxxxxx_me.com> wrote in message
news:eRFoPIKSJHA.3880@xxxxxx

> At the end of that I'll have a defragged, compacted smaller file and it
> will be contiguous on the drive.
Yes, assuming there was enough free space on the host drive to actually
allow the .vmd to defragment in the first place.

And, of course, as soon as you use the virtual machine, its virtual hard
disk will become fragmented again - how badly fragmented will, as above,
depend on how much free space remains on the host drive...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net
 

My Computer

R

Richard Urban

#14
Good plan. <wink>

I do this about once a month for each VM that is used frequently.

--

Richard Urban
Microsoft MVP
Windows Desktop Experience


"d d" <go_on_try_and_sp@xxxxxx_me.com> wrote in message
news:eRFoPIKSJHA.3880@xxxxxx

> Richard Urban wrote:

>> If you do a lot of install/uninstall of programs for testing purposes the
>> VM (physical size on disk) seems to grow in size. To solve for this
>> condition you need to empty the recycle bin (or use CCleaner to get out
>> the crud) and then defragment. You can then prepare the VM for compaction
>> (use the virtual disk precompactor from with VM Additions).
>>
>> After you close down the VM you can use the Virtual Disk Wizard to
>> compact the VM. I have seen the physical size of the VM decrease by 2-4
>> gig in physical size and the aftermath is that the VM seems a bit more
>> responsive when I again use that particular VM.
>
> Thanks. Good tips.
>
> So I think I've formulated a good plan:
>
> 1. Delete temporary files and windows update temp files etc to generally
> clean up.
>
> 2. Empty recycle bin.
>
> 3. Defrag inside the VM.
>
> 4. Run the pre-compactor and close the VM.
>
> 5. Run the Compactor.
>
> 6. Run Contig on the VHD.
>
> At the end of that I'll have a defragged, compacted smaller file and it
> will be contiguous on the drive.
 

My Computer

#15
Richard Urban wrote:

> Good plan. <wink>
>
> I do this about once a month for each VM that is used frequently.
I plan to do it once a week. I have this "Work VM" that I use for all
work-related stuff. When I'm at home it's running on my home desktop PC.
When I'm away on business it's running on my laptop. When I'm at work
it's running on whatever PC is available. I never need to worry about
syncing any more. That work VM is my entire work PC with Office,
messenger, favorites, tools, compilers, SVN, VPN connections, every
thing is on there. I make a daily backup of the file at the end of the
day onto a different drive, and also copy it onto a 32GB USB Flash
drive. There's no way any hardware failures or nasty virus attacks are
keeping me from working. Of course I keep the VPC2007 installer on the
Flash drive too ;-)
 

My Computer

B

Bo Berglund

#16
On Mon, 17 Nov 2008 00:31:36 -0800, DevilsPGD
<spam_narf_spam@xxxxxx> wrote:

>In message <ps22i45p3p1q7tpj2f9hgsr4mlmi82npu2@xxxxxx> Bo Berglund
><boberglund@xxxxxx> was claimed to have wrote:
>

>>On Sun, 16 Nov 2008 14:26:26 -0800, DevilsPGD
>><spam_narf_spam@xxxxxx> wrote:
>>

>>>To have an effect you must defragment within the guest first, then if
>>>you're using an expanding VHD rather then a fixed size compact, then
>>>finally defragment at least that one VHD file if not the entire drive.
>>
>>How do you defragment a single file?
>>I have never seen that option in the Windows defragmenter.
>
>Windows' defragmenter doesn't do it, but Contig does:
>
>http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx
Thanks for the pointer, I am testing it now on a vhd file of 3.5 Gb
size..

--

Bo Berglund (Sweden)
 

My Computer

#17
Bo Berglund wrote:

> On Mon, 17 Nov 2008 00:31:36 -0800, DevilsPGD
> <spam_narf_spam@xxxxxx> wrote:

>> Windows' defragmenter doesn't do it, but Contig does:
>>
>> http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx
>
> Thanks for the pointer, I am testing it now on a vhd file of 3.5 Gb
> size..
I tried it too. I have a 10GB vhd (it was 14.7GB before compacting) and
it was fragmented into 67 parts before Contig. Now it's in 2 parts. Sure
it'll fragment again, but I won't let it get up to 67. I like the fact
that it only takes a second or two to analyze how defragmented a vhd is.
You can set your own criteria for when you'll decide to defragment it.
 

My Computer

D

DevilsPGD

#18
In message <eS$MylOSJHA.5080@xxxxxx> d d
<go_on_try_and_sp@xxxxxx_me.com> was claimed to have wrote:

>Bo Berglund wrote:

>> On Mon, 17 Nov 2008 00:31:36 -0800, DevilsPGD
>> <spam_narf_spam@xxxxxx> wrote:

>>> Windows' defragmenter doesn't do it, but Contig does:
>>>
>>> http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx
>>
>> Thanks for the pointer, I am testing it now on a vhd file of 3.5 Gb
>> size..
>
>I tried it too. I have a 10GB vhd (it was 14.7GB before compacting) and
>it was fragmented into 67 parts before Contig. Now it's in 2 parts. Sure
>it'll fragment again, but I won't let it get up to 67. I like the fact
>that it only takes a second or two to analyze how defragmented a vhd is.
>You can set your own criteria for when you'll decide to defragment it.
The downside to be aware of is that it only really considers the one
file it's working on, it doesn't build a "big picture" map of the drive,
so running contig on each file on the drive sequentially won't result in
a drive as optimized as an all-in-one defrag tool.

Specifically it can't always group all files within a directory
together, which is useful for some collections of files, although less
useful for others.

Where I find contig really shines is for special purpose drives or
applications. I have a physical drive devoted to virtual machine data
files, and generally preallocate most files, in this case contig is just
what the doctor ordered and far more efficient then a full disk
defragger which may decide to move files that only have one fragment
into more optimum locations on the drive.

Also remember that you need to run contig elevated, I seem to recall
it's error message being less then useful if you run it without
elevation under Vista.
 

My Computer

B

Bo Berglund

#19
On Mon, 17 Nov 2008 19:56:32 -0800, DevilsPGD
<spam_narf_spam@xxxxxx> wrote:

>In message <eS$MylOSJHA.5080@xxxxxx> d d
><go_on_try_and_sp@xxxxxx_me.com> was claimed to have wrote:
>

>>Bo Berglund wrote:

>>> On Mon, 17 Nov 2008 00:31:36 -0800, DevilsPGD
>>> <spam_narf_spam@xxxxxx> wrote:
>>>> Windows' defragmenter doesn't do it, but Contig does:
>>>>
>>>> http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx
>>>
>>> Thanks for the pointer, I am testing it now on a vhd file of 3.5 Gb
>>> size..
>>
>>I tried it too. I have a 10GB vhd (it was 14.7GB before compacting) and
>>it was fragmented into 67 parts before Contig. Now it's in 2 parts. Sure
>>it'll fragment again, but I won't let it get up to 67. I like the fact
>>that it only takes a second or two to analyze how defragmented a vhd is.
>>You can set your own criteria for when you'll decide to defragment it.
>
>The downside to be aware of is that it only really considers the one
>file it's working on, it doesn't build a "big picture" map of the drive,
>so running contig on each file on the drive sequentially won't result in
>a drive as optimized as an all-in-one defrag tool.
>
>Specifically it can't always group all files within a directory
>together, which is useful for some collections of files, although less
>useful for others.
>
>Where I find contig really shines is for special purpose drives or
>applications. I have a physical drive devoted to virtual machine data
>files, and generally preallocate most files, in this case contig is just
>what the doctor ordered and far more efficient then a full disk
>defragger which may decide to move files that only have one fragment
>into more optimum locations on the drive.
>
>Also remember that you need to run contig elevated, I seem to recall
>it's error message being less then useful if you run it without
>elevation under Vista.
I tried Contig on an 80 Gb drive with a 25 Gb VHD file and an ISO and
some other files (in total about 10-15 files totalling 14 Gb).
So I have 41 Gb free.
Unfortunately even though I have run Contig several times and also
used the WinXP dfragger on the drive my VHD will not glue together....
It is now sitting with 4 fragments and when I view the graphics in the
WinXP defragger I see big chunks spread out evenly across the drive.
:-(

Why is none of these products able to consolidate the data towards the
start of the drive so the free space is contiguous and a big area?

--

Bo Berglund (Sweden)
 

My Computer

R

Richard Urban

#20
Get a good 3rd party PAID FOR defragmenter to take care of your condition.

PerfectDisk will do what you want.

--

Richard Urban
Microsoft MVP
Windows Desktop Experience


"Bo Berglund" <boberglund@xxxxxx> wrote in message
news:vts5i4tf434c2b39c30n07h2hbdagk4kko@xxxxxx

> On Mon, 17 Nov 2008 19:56:32 -0800, DevilsPGD
> <spam_narf_spam@xxxxxx> wrote:
>

>>In message <eS$MylOSJHA.5080@xxxxxx> d d
>><go_on_try_and_sp@xxxxxx_me.com> was claimed to have wrote:
>>

>>>Bo Berglund wrote:
>>>> On Mon, 17 Nov 2008 00:31:36 -0800, DevilsPGD
>>>> <spam_narf_spam@xxxxxx> wrote:
>>>>> Windows' defragmenter doesn't do it, but Contig does:
>>>>>
>>>>> http://technet.microsoft.com/en-us/sysinternals/bb897428.aspx
>>>>
>>>> Thanks for the pointer, I am testing it now on a vhd file of 3.5 Gb
>>>> size..
>>>
>>>I tried it too. I have a 10GB vhd (it was 14.7GB before compacting) and
>>>it was fragmented into 67 parts before Contig. Now it's in 2 parts. Sure
>>>it'll fragment again, but I won't let it get up to 67. I like the fact
>>>that it only takes a second or two to analyze how defragmented a vhd is.
>>>You can set your own criteria for when you'll decide to defragment it.
>>
>>The downside to be aware of is that it only really considers the one
>>file it's working on, it doesn't build a "big picture" map of the drive,
>>so running contig on each file on the drive sequentially won't result in
>>a drive as optimized as an all-in-one defrag tool.
>>
>>Specifically it can't always group all files within a directory
>>together, which is useful for some collections of files, although less
>>useful for others.
>>
>>Where I find contig really shines is for special purpose drives or
>>applications. I have a physical drive devoted to virtual machine data
>>files, and generally preallocate most files, in this case contig is just
>>what the doctor ordered and far more efficient then a full disk
>>defragger which may decide to move files that only have one fragment
>>into more optimum locations on the drive.
>>
>>Also remember that you need to run contig elevated, I seem to recall
>>it's error message being less then useful if you run it without
>>elevation under Vista.
>
> I tried Contig on an 80 Gb drive with a 25 Gb VHD file and an ISO and
> some other files (in total about 10-15 files totalling 14 Gb).
> So I have 41 Gb free.
> Unfortunately even though I have run Contig several times and also
> used the WinXP dfragger on the drive my VHD will not glue together....
> It is now sitting with 4 fragments and when I view the graphics in the
> WinXP defragger I see big chunks spread out evenly across the drive.
> :-(
>
> Why is none of these products able to consolidate the data towards the
> start of the drive so the free space is contiguous and a big area?
>
> --
>
> Bo Berglund (Sweden)
 

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)