Page 1 of 1

One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 15:09
by taxshack
Help, please! Newbie use of VB. I went through the process of successfully creating my first VM, complete with five snapshots along the way. I read the user manual throughout the process and I'm now a experienced newbie. I read that I shouldn't be using snapshots as a way to do backups and that cloning was better. I did manual copying of files to a backup location on the host before messing around with deleting snapshots (via the VB app) to get down to one .VDI file. Suffice it to say, with copies on the host, I screwed up my VM. Somehow, though, I got my VM back, albeit with the image of the very first snapshot (which was after Win7 install and before the days-long task of installing Windows Updates). OK, I'm smarter now, but need help with getting all the VM stuff on one folder - without screwing up my good VM.

I never liked data going to my C: drive and I like my data in one place - separating O/S from data. I have a second physical hard drive (logical F:) dedicated for my VM stuff. I managed to get most of my VM data on F:\Oracle, probably from setting the Environment variable VBOX_USER_HOME to this folder, at some point in the process-to-date. However, some of the VM data is still on C:\Documents and Settings\Administrator\Virtualbox VMs\DELLWIN7, DELLWIN7 being my VM name. In this folder is the Logs folder and the .VBOX machine file and the VBOX-Prev. I think I'd get into trouble by simply copying the contents of this folder to F:\Oracle\DELLWIN7 folder.

F:\Oracle currently contains the DELLWIN7 folder (which has the .VDI in it), security certificate stuff, various SVC logs and Virtualbox XML and XML-Prev. Other than Vbox executables being in \Program Files, there is no VB stuff anywhere else on my drives.

Can someone please help me get the C: drive stuff above to the F: drive, permanently and for all future use? Would this involve editing (one time) an XML file and/or Windows Registry? If so, I'm game.

Also, once everything is on the F: drive, can I simply do normal file-copy backups to a place not on the host, like a portable drive and then use that to restore if ever needed? I know I can do an image backup of F: that would work, but that's time-consuming.

Re: One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 15:36
by scottgus1
If you have a good VM which you wish to move to a different drive, see this tutorial Moving a VM. This method is good for backups as well, just make the copy but don't register the copy. Restoring involves simply copying the files back over the bunged-up originals, while the VM is shut down. Storing the copies on external drives is fine.

It sounds like there might be a bit of a mixup of the files defining your VM. I don't recognize the file layout. Might have something to do with footling about with the "VBOX_USER_HOME" along the way, I never have altered this variable so I don't know all it does.

If this VM still boots right, we might be able to figure out what to do with a couple screenshots. Try this:
1. Open the "C:\Documents and Settings\Administrator\Virtualbox VMs\DELLWIN7" folder, and set the view to Details. Arrange the columns so the file name and date last modified are side-by-side.
2. take a screenshot of the folder window, edit it in Paint so the file size is less than 128kB, and post it as an attachment to your post (see the bottom of the posting window).
3. repeat the above two steps for the F drive folder that has the .vdi and the xml's. Post the screenshot.

Note that there is a way to get rid of the snapshots safely, we can deal with that afterwards. (Thanks for the new post, btw!)

Re: One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 15:47
by mpack
VBOX_USER_HOME determines where VirtualBox.xml and the VBoxSVC log are stored. Since both of these files are tiny and unimportant it IMHO isn't worthwhile moving it to another drive. The correct way to set a new folder for new VMs (that don't exist yet) is to set File|Preferences|General|Default_Machine_Folder. This only affects where new VMs will be created. If you want to move a VM that already exists then view the FAQ already mentioned.

VMs are what occupy real space, and the FAQ tells you how to move one. One thing you absolutely should not do is move the VDI and leave the rest of the VM behind. Doing so is asking for trouble, as is using snapshots period.

Re: One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 18:44
by taxshack
Thanks to both of you. mpack, my DELLWIN7 folder that contains the .vdi is in the F:\Oracle folder. Whether it got there because I specified that path in VBOX_USER_HOME or if I set File/Preferences like you said or I flat moved it in there - I can't remember! This VM (which is the only one I have) is working. I just noticed File/Pref does have this path.

scottgus1, I'm in the middle of Win Updating my guest and don't want anything to happen on the host while it's cranking (including getting a screenshot/paint). But the C: drive is simple:

Address - Folder C:\Documents and Settings\Administrator\VirtualBox VMs\DELLWIN7
Logs File Folder 1/15/2016 7:12 AM
DELLWIN7 VirtualBox Machine Definition 1/15/2016 11:18 AM
DELLWIN7.vbox-prev VBOX-PREV File 1/15/2016 5:12 AM

Address - Folder F:\Oracle
DELLWIN7 File Folder 1/15/2016 5:52 AM
selectorwindow Text Document
selectorwindow.log 1 File
vbox-ssl-cacertificate Security Certificate
VboxSVC Text Document
VboxSVC.log 1 File
VboxSVC.log 2 File
VboxSVC.log 4 File
VboxSVC.log.3 3 File
VboxSVC.log.5 5 File
VboxSVC.log.6 6 File
VboxSVC.log.7 7 File
VboxSVC.log.8 8 File
VirtualBox XML Document 1/15/2016 5:14 AM
VirtualBox.xml-prev XML-PREV File 1/15/2016 5:14 AM

And in DELLWIN7 folder is:
DELLWIN7 Virtual Disk Image 1/15/2016 11:20 AM

That's it, kemo sabe. I've got the Name, Type and Date Modified spaced apart here, but when it posts?????

Re: One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 18:51
by taxshack
I guess the question then is: the DELLWIN7 Virtual Box Machine Definition and the PREV on the C: drive - does VirtualBox store this location somewhere? If not, I suppose we can just move it to F:\Oracle somewhere. Otherwise, we need to modify the place(s) VirtualBox stores this path and change it to the F: path we want. Or is it not that simple?

BTW, does VirtualBox store anything in Windows Registry (other than executables)?

Re: One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 19:01
by scottgus1
OK, that makes sense. These things in F:\Oracle:

Code: Select all

selectorwindow Text Document
selectorwindow.log 1 File
vbox-ssl-cacertificate Security Certificate
VboxSVC Text Document
VboxSVC.log 1 File
VboxSVC.log 2 File
VboxSVC.log 4 File
VboxSVC.log.3 3 File
VboxSVC.log.5 5 File
VboxSVC.log.6 6 File
VboxSVC.log.7 7 File
VboxSVC.log.8 8 File
VirtualBox XML Document 1/15/2016 5:14 AM
VirtualBox.xml-prev XML-PREV File 1/15/2016 5:14 AM
are the logs and definition files for Virtualbox itself, including the guests Virtualbox has found.
These files are here instead of C:\Users\{yourusername}\.Virtualbox because of the VBOX_USER_HOME change.

The folder F:\Oracle\DELLWIN7 containing the DELLWIN7 disk image is there probably because you told it to be made there when the guest was first made. Virtualbox allows you to put the disk image anywhere you want, but doing so isn't good practice.

The folder C:\Documents and Settings\Administrator\VirtualBox VMs\DELLWIN7 contains the logs and the definition files for the guest itself. These can be moved to the F drive and consolidated with the disk image to make one nice package for backups later. I'll tell you how to do that after lunch...

Re: One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 19:44
by taxshack
Awesomesauce. How's that out of a 63 year old. Have a good lunch. I had mine and may be napping soon. . . . .

Re: One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 19:48
by scottgus1
OK, lunch is over :)

Make sure the guest is completely shut down. You are going to remove the guest from Virtualbox without deleting anything, reposition the guest's definition files, then reconnect everything in Virtualbox.

In the main Virtualbox window, open the guest's storage settings. Remove any ISO's mounted in the virtual CD drive(s). Take careful note of which port the guest's virtual disk(s)s are attached to - you are going to disconnect them. You do not need to remove the controllers themselves, just right-click the disk(s) and choose "Remove Attachment". Close the Settings window.

Right-click the guest in the list and click Remove. In the warning box that appears click Remove Only (Don't get anywhere near "Delete all files".)

Open the File menu, then the Virtual Media Manager. Find the guest's disk file in the list and select it. Click "Remove" in the toolbar, then in the pop-ups click the Remove button then the Keep button. Don't click Delete, that'll kill your guest but good. The guest disk file will disappear from the list. Close the Virtual Media Manager, and the main Virtualbox window.

Take the contents of the "C:\Documents and Settings\Administrator\VirtualBox VMs\DELLWIN7" folder (Logs folder, .vbox file and .xbox-prev files) and copy (not move) them to the "F:\Oracle\DELLWIN7" folder. You should have the Logs folder, the .vbox and .vbox-prev, and the virtual disk all in the one folder "F:\Oracle\DELLWIN7". (the copies still on the C drive will still allow the guest to start if something goes wrong. But nothing will go wrong, right?)

Double-click the .vbox file in "F:\Oracle\DELLWIN7". The guest should re-appear in the Virtualbox window, with no disks attached. Open the guest's Storage settings, click the correct controller and "add hard disk". Choose an existing disk, browse to the disk file in "F:\Oracle\DELLWIN7" and choose it.

Your guest should now all be contained in the "F:\Oracle\DELLWIN7" folder and should run just fine. Backups will involve shutting down the guest and copying the "F:\Oracle\DELLWIN7" folder to other media. Restoring would be shutting down the guest and copying the backed up DELLWIN7 folder back into the "F:\Oracle" folder, overwriting the contents of "F:\Oracle\DELLWIN7".

Re: One Folder For All Virtualbox Data

Posted: 15. Jan 2016, 23:40
by taxshack
Followed your instructions and we're back to running Guest. Assume it's all based on the F: drive components now.

Thanks very much! I was going to ask a few more questions, but I've already taken up enough of your time. I can't give you guys high enough marks for your professionalism and attention. Go help somebody else now!

Re: One Folder For All Virtualbox Data

Posted: 16. Jan 2016, 11:27
by mpack
[I see you edited your post to remove the suggestion, but I'll let my reply remain since I spent several minutes writing it!]

> The media register is used to register drives?
Not quite correct. There is no real global registry in VirtualBox any more, the remnants are largely a legacy from v3 days. The apparent global register is an almalgam of all the local VM registers, so there is no concept of using File|Media Manager to register a drive.

To register and attach a drive, use the Storage panel of the VM. Use the VM to delete drives from the VM recipe, however the drive file remains registered even after the drive is detached.

Use File|Media Manager to detach a drive file from multiple VMs at once, and to unregister drives.


As to the rest, yes you use the manager to register and unregister VMs. If you unregister a VM then VirtualBox forgets the VM and all the media it had.

The VM register is stored in VirtualBox.xml, a tiny file which does little more than store the list of VMs and a few global preferences. This file can be found in the VBOX_USER_HOME folder.