VB Host, Guest and Defrag

This is for discussing general topics about how to use VirtualBox.
nkaufman
Posts: 26
Joined: 28. May 2013, 17:04

VB Host, Guest and Defrag

Post by nkaufman »

Hello,

In order to keep the performance of Guest at a reasonable level, I'm defragging both host and guest and am wondering if that is the way to go.

Thanks,
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VB Host, Guest and Defrag

Post by noteirak »

Unless you have a specific reason to suspect issue with fragmentation in the guest, it is of little benefits, as the guest hard drive is simply a file on your real harddrive. What could be useful (mpack, Perryg, correct me if I am wrong) is compacting.
But defraging your host would be the relevant part.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
nkaufman
Posts: 26
Joined: 28. May 2013, 17:04

Re: VB Host, Guest and Defrag

Post by nkaufman »

noteirak wrote:Unless you have a specific reason to suspect issue with fragmentation in the guest, it is of little benefits, as the guest hard drive is simply a file on your real harddrive. What could be useful (mpack, Perryg, correct me if I am wrong) is compacting.
But degraging your host would be the relevant part.

Thank you for your response.

How do I compact the drive? Perhaps I'll do a search in this forum and see.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VB Host, Guest and Defrag

Post by noteirak »

Two options :
- CloneVDI (native Windows, use Wine on Linux)
- Virtualbox builtin tool : vboxmanage with the modifyhd --compact option
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
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: VB Host, Guest and Defrag

Post by mpack »

Max performance comes when the VDI block order is defragmented (any CloneVDI op does this too), and the host file is defragged, and the guest is defragged. It doesn't all have to be done at once since each only adds a few percent.

One note: despite a similarity in names, the VBoxManage option will not actually compact the drive. All it does is discard zero blocks - which will not be present unless sdelete is run first. CloneVDI will do it without requiring sdelete, and in far less time than sdelete followed by VBoxManage.


Important ps. I see from another of your threads that you're using snapshots. That greatly limits your options. E.g. you can't usefully compact a disk that uses snapshots. If you try it with VBoxManage then the results will be poor. If you apply CloneVDI to the latest snapshot VDI then it will create a compacted, merged clone, but you can't use that in the original VM.
nkaufman
Posts: 26
Joined: 28. May 2013, 17:04

Re: VB Host, Guest and Defrag

Post by nkaufman »

mpack wrote:Max performance comes when the VDI block order is defragmented (any CloneVDI op does this too), and the host file is defragged, and the guest is defragged. It doesn't all have to be done at once since each only adds a few percent.

One note: despite a similarity in names, the VBoxManage option will not actually compact the drive. All it does is discard zero blocks - which will not be present unless sdelete is run first. CloneVDI will do it without requiring sdelete, and in far less time than sdelete followed by VBoxManage.


Important ps. I see from another of your threads that you're using snapshots. That greatly limits your options. E.g. you can't usefully compact a disk that uses snapshots. If you try it with VBoxManage then the results will be poor. If you apply CloneVDI to the latest snapshot VDI then it will create a compacted, merged clone, but you can't use that in the original VM.
Yes, am using Snapshots.

Coming from VPC 2007 where I could create a VM, then save state while I'm working, delete all changes from base, then make updates that I want and then save the updates back to the original VM state.... How VB does it is quite confusing.

I save the states everytime I do a major update so if I make a mistake I just take the previous saved 'major' state backup that I have and go from there.

Do not know how to achieve the same while using VB.

Did I explain clearly? If not then please let me know. I know people who are new to VB might say something that can mean different thing to an experienced user.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VB Host, Guest and Defrag

Post by noteirak »

If you keep all your snapshots, performance will decrease, and you'll be using (very much) a lot of space for your VM.
If that's what you're doing, I think you should simply reach a time when you're confident about the VM being the way you like it, and then delete all your snapshots.
You can then proceed with degrag & compactation.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
nkaufman
Posts: 26
Joined: 28. May 2013, 17:04

Re: VB Host, Guest and Defrag

Post by nkaufman »

noteirak wrote:If you keep all your snapshots, performance will decrease, and you'll be using (very much) a lot of space for your VM.
If that's what you're doing, I think you should simply reach a time when you're confident about the VM being the way you like it, and then delete all your snapshots.
You can then proceed with degrag & compactation.
But that is the problem that I faced when I deleted snapshots. I lost all my changes.
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, OSX
Location: U S of A

Re: VB Host, Guest and Defrag

Post by ChipMcK »

nkaufman wrote:But that is the problem that I faced when I deleted snapshots. I lost all my changes.
Have you noted the ability to clone the virtual machine?
Menu Bar --> Machine --> Clone . . .

This will create new virtual disk (vdi, vmdk, etc) with the snapshots merged.
You would then create new virtual machine based that "new" existing virtual hard drive
Best
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VB Host, Guest and Defrag

Post by noteirak »

nkaufman wrote:But that is the problem that I faced when I deleted snapshots. I lost all my changes.
This happens if you REVERT BACK to the snapshot. I am talking about DELETING here.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
nkaufman
Posts: 26
Joined: 28. May 2013, 17:04

Re: VB Host, Guest and Defrag

Post by nkaufman »

noteirak wrote:
nkaufman wrote:But that is the problem that I faced when I deleted snapshots. I lost all my changes.
This happens if you REVERT BACK to the snapshot. I am talking about DELETING here.
So in my case:
(1) Created new VM and installed OS
(2) Created Snapshot 1
(3) Installed OS updates
(4) Created Snapshot 2
(5) Installed various softwares
(6) Created Snapshot 3

I do not care about current state. SS-3 is what I am looking for as final state.

Should I now close VM. Open VB, go to Snapshot, right click and choose - Delete. And that will work?

Any particular order I should go with - SS-1 then SS-2 OR should it be first SS-3 then SS-2...?

Thanks for your help..
nkaufman
Posts: 26
Joined: 28. May 2013, 17:04

Re: VB Host, Guest and Defrag

Post by nkaufman »

ChipMcK wrote:
nkaufman wrote:But that is the problem that I faced when I deleted snapshots. I lost all my changes.
Have you noted the ability to clone the virtual machine?
Menu Bar --> Machine --> Clone . . .

This will create new virtual disk (vdi, vmdk, etc) with the snapshots merged.
You would then create new virtual machine based that "new" existing virtual hard drive
Best
Interesting.

Looking at it.

Now when I select full clone while using cloning, the next step asks for "Current state" OR "All States". Which one should I choose?

Thanks for your help.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: VB Host, Guest and Defrag

Post by noteirak »

Simply delete yes, do NOT "restore snapshot" (exact wording use), but only "delete snapshot" (again, exact wording, the icon is a computer with a red cross).
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
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: VB Host, Guest and Defrag

Post by mpack »

You should clone the current state only. The "all states" option preserves the snapshot structure, which is precisely what you want to be rid of.
nkaufman
Posts: 26
Joined: 28. May 2013, 17:04

Re: VB Host, Guest and Defrag

Post by nkaufman »

mpack wrote:You should clone the current state only. The "all states" option preserves the snapshot structure, which is precisely what you want to be rid of.
Any particular order I should go with - SS-1 then SS-2 OR should it be first SS-3 then SS-2...?

What I've done is copied my VM file folder to another folder. I'll then try and delete snapshots.

if there is any issue, can i just copy the VM folder that I had copied and move it to the original folder. Will that work seamlessly or will i need to do something else to get the VM working?

Just making sure I take all precautions before doing the deletes :-)
Post Reply