Defragmenting
Defragmenting
I"m using my work computer which is running windows xp, and have a Virtualbox runnning Xp for the company I do IT for. I am really sluggish and the laptop itself cant defrag because of the virtualbox file on the hard drive. how can i defrag the computer and get better performance out of the machine
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Defragmenting
Having a VirtualBox VM located on a host disk will not an any way prevent a host defrag tool from running. A virtual disk is nothing special, it's just another host file. Of course, no other applications should be running when you run a defrag tool. For that reason proper defrags are usually done offline, e.g. at night.
p.s. Defragging can sometimes add a few percent to the performance of a PC. If the PC is particularly slow (and wasn't always so) then the causes usually lie elsewhere [cough]antivirus[/cough].
p.s. Defragging can sometimes add a few percent to the performance of a PC. If the PC is particularly slow (and wasn't always so) then the causes usually lie elsewhere [cough]antivirus[/cough].
Re: Defragmenting
I know it shouldn't cause any trouble, but when i run defragmentation on the computer it will not defrag the VDI file for the virtualbox.
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Defragmenting
"VirtualBox" is the name of the software. The guest is called a guest or a VM.Blight wrote:I know it shouldn't cause any trouble, but when i run defragmentation on the computer it will not defrag the VDI file for the virtualbox.
On "will not defrag the VDI file" - it depends what you mean: the host file will be defragged, but the internal logical structure of the file won't be affected by this hence the (dynamic) VDI block order may still be fragmented, ditto the guest filesystem.
If you want to go fully anal then the complete defrag strategy would be :-
- Defrag the guest filesystem - you'll need to run a defrag tool inside the guest.
- Clone the VDI using the CloneVDI tool (see sticky near top of this forum). This will linearize the VDI block order.
- Defrag the host filesystem - i.e. run a defrag tool on the host.
You should also avoid the use of snapshots, as these can quickly use up host disk space and lead to congestion and poor performance. Likewise fixed sized disks.
Re: Defragmenting
You have probably filled the HOST disk too full so that there is no room to defrag the disk, that is there is no place for defrag to move the files to in order to put the files in a neat and tidy order. Many defrag utils require about 10-15 percent of the disk to operate.Blight wrote:I know it shouldn't cause any trouble, but when i run defragmentation on the computer it will not defrag the VDI file for the virtualbox.
Several options:
Delete enough files to make enough room. Got a lot of cruft? Get rid of it. Perhaps CCleaner or some other like util may help. Reduce the size of the pagefile to a very small amount to make room, do the defrag then restore it to proper proportions when finished.
Get a bigger HDD clone the old one and then do it
ADD another disk and move the VDI file to it, if you already have another local HDD or other partition with room, export the VM to this disk, delete the original instance and re-add it from the new location. EDIT: Look at the HowTo to get tips how to do this.
Temporarily move the VDI file to another location (USB drive, network share, etc.), do the defrag and then move the VDI file back to it's original location.
It would be wise to also defrag the GUEST OS as well after defragging the HOST.
All in all while it is a good idea I think that the performance you will pick up from this will probably be marginal at best. I would also look in to why the GUEST is so sluggish. Laptops sometimes have slow processors and slow HDDs. Assigning too much RAM or too many processors to the guest can cut performance too. You need to balance out what each needs. Is performance set to MAX in the hosts Power Settings? The guest? Put the entire VirtualBox app program into your Antivirus exception list to keep it from examining the files as they run, put the Guests Home folder (where the VDI is located) in it too.
Last edited by Rootman on 17. Sep 2013, 02:23, edited 2 times in total.
-
mpack
- Site Moderator
- Posts: 39134
- Joined: 4. Sep 2008, 17:09
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Mostly XP
Re: Defragmenting
Sorry Rootman, but I have to contradict much of that advice, as some of it at least is potentially catastrophic.
First, it shouldn't be possible to have a disk so full that defragging doesn't work. While performance may suffer it should always be possible to shuffle clusters into a linear order without needing extra disk storage. Which tools are you thinking of that "require about 10-15 percent of the disk [space to be available]" to do it?
Second, if you are suffering performance problems then you certainly should not suggest reducing the size of the swap file. If the problem is shortage of RAM then that would increase the shortage.
You should never recommend that someone move the VDI around without caveats. Suppose he's using snapshots? There's a "howto" article that describes the correct way to move a VM, assuming that is even necessary.
Your final paragraph is ok, and you have reminded me to mention that one cause of poor performance can be overcommitting host resources, e.g. using too much host RAM, too many CPU cores etc.
First, it shouldn't be possible to have a disk so full that defragging doesn't work. While performance may suffer it should always be possible to shuffle clusters into a linear order without needing extra disk storage. Which tools are you thinking of that "require about 10-15 percent of the disk [space to be available]" to do it?
Second, if you are suffering performance problems then you certainly should not suggest reducing the size of the swap file. If the problem is shortage of RAM then that would increase the shortage.
You should never recommend that someone move the VDI around without caveats. Suppose he's using snapshots? There's a "howto" article that describes the correct way to move a VM, assuming that is even necessary.
Your final paragraph is ok, and you have reminded me to mention that one cause of poor performance can be overcommitting host resources, e.g. using too much host RAM, too many CPU cores etc.
Re: Defragmenting
Defraggler for one, contig/wincontig another. Since I've stuck with defraggler I frankly can't name any more, but I know it was an issue with a few other aftermarket utils. Even Windows built in defragger won't work WELL without adequate room as it repeatedly shuffles stuff back and forth doing "slight of hand" to linearize the files. Especially with a lot of large files like VDIs. I personally no longer defrag within the OS, I boot to a Windows 7 PE, delete all the temp files, recycle bin and swap file and then defrag. But this is far beyond the scope of this post to recommend that.mpack wrote:Sorry Rootman, but I have to contradict much of that advice, as some of it at least is potentially catastrophic.
First, it shouldn't be possible to have a disk so full that defragging doesn't work. While performance may suffer it should always be possible to shuffle clusters into a linear order without needing extra disk storage. Which tools are you thinking of that "require about 10-15 percent of the disk [space to be available]" to do it?
Perhaps I didn't define it well, but in a pinch if you have a large swap file, reduce the size to open up space for a defragger to work, do the defrag while running nothing else, THEN restore the swap file size back to your previous setting. Not elegant but I've used it before to get around space issues. Of course reducing the swap file below optimal will hurt performance.Second, if you are suffering performance problems then you certainly should not suggest reducing the size of the swap file. If the problem is shortage of RAM then that would increase the shortage.
Sure, I would suspect that he would actually look up HOW to do a move before trying it. I was simply pointing out a possibility to make more room on his affected disk. So, a question, why didn't YOU supply a link to the HOWTO rather than just stating there are caveats? HOWTO move a VM: viewtopic.php?f=35&t=55003You should never recommend that someone move the VDI around without caveats. Suppose he's using snapshots? There's a "howto" article that describes the correct way to move a VM, assuming that is even necessary.
Well, glad I didn't totally disappoint youYour final paragraph is ok, and you have reminded me to mention that one cause of poor performance can be overcommitting host resources, e.g. using too much host RAM, too many CPU cores etc.