Cloning Virtual Box Machines

January 20, 2010 by · Leave a Comment 

By Adil James, MMNS

ScreenShot084

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.

cleaned-83 copy 

 

 

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.

 

Errors:

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.

Rice

August 27, 2009 by · Leave a Comment 

tufail 11-36 The starchy grain of this plant, used as a staple food throughout the world.

* Prior to planting, minimal soil manipulation is needed to prepare for cultivation. If the rice will be grown on a hilly terrain, the area must be leveled into terraces. Paddies are leveled and surrounded by dikes or levees with the aide of earth-moving equipment. Then, the fields are plowed before planting. In the United States, rice is most often planted on river deltas and plowing is accomplished with a disk plow, an off-set disk plow, or a chisel. Adequate irrigation of the terrace or river delta bed is required and accomplished by leveling and by controlling water with pumps, reservoirs, ditches, and streams.

* Rice seeds are soaked prior to planting.

* Depending on the level of mechanization and the size of the planting, seeding occurs in three ways. In many Asian countries that haven’t mechanized their farming practices, seeds are sown by hand. After 30-50 days of growth, the seedlings are transplanted in bunches from nursery beds to flooded paddies. Seeds can also be sown using a machine called a drill that places the seed in the ground. Larger enterprises often found in the United States sow rice seed by airplane. Low-flying planes distribute seed onto already flooded fields. An average distribution is 90-100 lb per acre (101-111 kg per hectare), creating roughly 15-30 seedlings per square foot.

* Once the plants have reached full growth (approximately three months after planting) and the grains begin to ripen—the tops begin to droop and the stem yellows—the water is drained from the fields. As the fields dry, the grains ripen further and harvesting is commenced.

* Depending on the size of the operation and the amount of mechanization, rice is either harvested by hand or machine. By hand, rice stalks are cut by sharp knives or sickles. This practice still occurs in many Asian countries. Rice can also be harvested by a mechanized hand harvester or by a tractor/horse-drawn machine that cuts and stacks the rice stalks. In the US, most operations use large combines to harvest and thresh—separate the grain from the stalk—the rice stalks.

* If the rice has been harvested by hand or by a semi-automated process, threshing is completed by flailing the stalks by hand or by using a mechanized thresher.

* Before milling, rice grains must be dried with artificially heated air or, more often, with the help of naturally occurring sunshine. Rice grains are left on racks in fields to dry out naturally. Once dried, the rice grain, now called rough rice, is ready for processing.

11-36

Tunnels

August 13, 2009 by · Leave a Comment 

tufail 11-34

A tunnel is an underground passage that may be used for car or boat traffic, subways, pedestrians, water  or sewage, or power and communication line. Some of the earliest tunnels were the roman aqueducts. They were used to carry clean water into the cities and transport sewage away. Even without electric machinery, the Romans constructed tunnels that lasted until modern time.

The method used to create a tunnel depends on where it is to be constructed and what material will surround it. A tunnel through mountain rock is usually made with a tunnel-boring machine, or mole. This powerful machine is shaped like a large cylinder: it cuts and grinds through rock, leaving behind a passageway. Because rock surrounds the tunnel, extra support isn’t necessary during construction. Explosives were used before the invention of moles, but moles are safer and quieter. They also leave behind a smoother tunnel of the exact shape the engineers want.

11-34