By Adil James, MMNS
Virtual Box is probably the best program, currently, for making virtual machines. I havenâ€™t tried the others, but I did Google the issue and by reputation itâ€™s by far the fastest, and itâ€™s free. Itâ€™s made by Sun, so with the backing of such a major tech company you know it has to be pretty good.
I have had two virtual XP installations running at the same time on a dual core machine with 2.5 gigs of RAM. I had a full load of other programs running as I recall, including Firefox (which sometimes eats a lot of memory). They ran okay but did crash the machine (grinding everything to a standstill, which had never happened before)â€”still I am amazed at how well the whole thing functioned.
We happen to have several XP Pro licenses because we bought several machines brand new, some of which are now running other OSs.
An issue with Virtual Box machines is cloning, however. It should actually be pretty easy to clone a machine, but actually it takes some doing. So I am going to give you the solution that I came to after some effort and lessons learned.
Of course itâ€™s a good idea to get the copy of the virtual machine into good shape (i.e. activated if applicable, with the programs that you want, whatever settings you want, and all the updates run). These instructions assume you have Virtual Box running on a Windows machine (here Windows 7 RC [sorry, I made a mistake, this is really windows XP running with a facelift (using Seven Remix) to look like W7… but I would think these basic principles still apply to W7 although I have not tested these directions under W7]), and in this case the Virtual Box machine I am cloning is also Windows (here XP). This method uses a â€œnon-documentedâ€ internal command of Virtual Box that could be turned off at any time by Sun but as of yesterday (January 19, 2010) and today too, it worked fine. There is another way using a documented command (clonehd) but I used the non-documented command because I had already made a copy of the drive I wanted and the easiest thing seemed to be to just make it usableâ€”and this way worked for me and made sense to me.
Although we did this on a Windows machine it should be pretty similar and about as easy in another OS, for example in Linux it is pretty routine to work on the command line so should be easier I guess. Most of the instructions on the web seemed like they were aimed at Linux/Ubuntu users so that is why I did this instruction set for Windows. Should make it easier to follow the paths and figure out where the necessary files are.
I donâ€™t know what will happen if you have snapshots of the drive you want to cloneâ€”I didnâ€™t have any snapshots of mine. In many directions the first step is to get rid of all snapshots.
Be careful because these virtual machines will eat a hard drive very quickly. I have about four virtual machines and my C drive went from being healthy and half empty to being nearly filled to capacity in just a couple of days.
Sorry, you have to go to the command line to do this.
Here is step by step how to do it:
Before you begin you must make sure the virtual machine to be cloned is turned off.
1) Make a copy of the .vdi file for the machine you want to clone. The path is:
C:\Documents and Settings\[user]\.VirtualBox\HardDisks\*.vdi
Just right click the file you want and copy it, giving the new file an easy-to-remember name, like for example â€œXP.vdiâ€ is the original file and â€œXPCopy.vdiâ€ is the new copy of it. Paste the copy into the same folder.
2) Reset the user id of the copy. This is the part of the procedure that uses an undocumented command, namely â€œsethduuidâ€ (here are the instructions I used but I will summarize below):
Open a command window: Start â€“ Run â€“ type â€œcmdâ€ in the box to open a black command window.
Type the following commands (filling in your user name in the [user] box) in the command window:
cd C:\Documents and Settings\[user]\.VirtualBox\HardDisks
â€œC:\Program Files\Sun\VirtualBox\VBoxManage.exeâ€ internalcommands sethduuid XPCopy.vdi
In above command make sure the path is right on your machine, and donâ€™t forget the quotation marks around the path to VBoxManage.exe. Of course you will have to put the correct name of your copied hard disk image, in this example I used XPCopy.vdi (and in the actual demo below I used â€œXPCopy2.vdiâ€) but yours is likely different.
3) Now you have to make a new Virtual Box machine and link it to your clone:
Open Sun Virtual Box â€¦ New â€¦ Next â€¦ [type the name of your clone machine and change the OS and version as necessary] â€¦ Next â€¦ [i just use the defaults] â€¦ Next â€¦ click â€œuse existing hard diskâ€ and click the folder button, click â€œAddâ€ and browse to the new .vdi file (in my example mine is XPCopy.vdi) â€¦ click â€œOpenâ€ â€¦ Select â€¦ Next â€¦ Finish
Ha. Youâ€™re all done. Start that new clone up and youâ€™re in business. I just followed these steps myself and it all worked but in case I left out a step or something please leave a comment on this article, which will eventually come to my attention.
I love your comments so whether you want to say thanks or want to say this doesnâ€™t work for you or something please add a comment.
1) I renamed a copy then stored the copy on an external drive then brought the .vdi copy back to the VirtualBox/HardDisks folder, and when I tried to reset the user id and got the error message â€œVERR_FILE_NOT_FOUNDâ€.
I kept getting this error, but not nowâ€¦
I suspect I was not in the â€œHardDisksâ€ subdirectory and this is why I was getting this error. You must be in the correct directory where you have the copy before this sethduuid command will work.
2) The whole reason I realized the importance of resetting the user id was because I got the error â€œCannot register the hard diskâ€¦â€ â€œUUID â€¦ already exists in the media registryâ€ when I tried to link to a .vdi image from a new machine, but without first going through the procedure of resetting the user id. The user id is attached to each virtual box image by Sun, not Microsoft. You cannot just copy another virtual machineâ€™s hard disk and then start a new virtual machine and link to it, youâ€™ll get the user id error.