Virtual Machines, Part Two: Snapshots, guest additions, and shared folders

Now that you’ve gotten either Windows or Ubuntu – or both – installed in VirtualBox it’s time to go further. This article – the second in the series on virtual machines – will teach you how to restoring virtual machines, integrate your mouse (and other guest additions), and even how to create shared folders.

Table of Contents

Taking and restoring Snapshots (Ubuntu and Windows)
Guest Additions (Ubuntu)
Guest Additions (Windows)
Setting up temporary shared folders (Step One, Ubuntu and Windows)
Setting up permanent shared folders (Step One, Ubuntu and Windows)
Accessing shared folders (Ubuntu)
Accessing shared folders (Windows)

Taking and Restoring Snapshots (Ubuntu and Windows)

Snapshots are literally a copy of the virtual machine as it currently is. You can use these to roll back changes, and the virtual operating system will have no idea that anything just happened. To take a snapshot of a virtual machine that is off, open the VirtualBox main window. Click on the operating system that you want to take a snapshot of.

Click the Snapshots tab.

Click the button that’s a camera.

Name it something informative, such as Just Installed or Mess This Up. You can even give it a description.

Now, the name of your snapshot will appear in the snapshots tab.

To restore the machine to a snapshot, click the name and then on the little icon with an up arrow.

Then click Restore. The image will be restored!

VirtualBox guest additions (Ubuntu)

To install the Guest additions- pieces of software such as drivers and things to make integration better- you’ll need to start your VM and log in. Then, from the top menu bar in the VirtualBox window (not in the virtual machine), click Devices>Install Guest Additions.

This will mount an ISO (disc image) that contains the installation files. To install them, you need to use Terminal. To open Terminal, click on Applications>Accessories>Terminal. To get to where the installers are located, type in cd /media/cdrom. Then, type ls to get a list of files. From that list, the file we want is VBoxLinuxAdditions-x86.run, so to get priveges to run it, type “sudo” into the command line, followed by “./VBoxLinuxAdditions-x86.run”.

Press enter and type in your password. Press enter again.

Wait a while. This may take some time.

When it’s done (see above) restart your computer- in the upper right hand corner, click your name and click restart. The computer will restart.

Now, you can pass your mouse through one OS to the other. You can also resize the window and even enter full screen and have the virtual machine automatically resize.

Guest Additions (Windows)

Guest additions in Windows are simple and easy.  Start up your virtual machine and from the top menu bar in the VirtualBox window (not in the virtual machine), click Devices>Install Guest Additions.  This will mount an ISO of the installation disc, and from there it’s a regular software install.  Open My Computer, then the disc drive.

Run through the software install, clicking Next or I Agree to any prompts.  The Unsigned driver window will pop up- just click Continue Anyway.

Your computer will reboot, and you’ll be able to set up shared folders and use mouse integration!

Setting up  temporary shared folders (Step One, Windows and Ubuntu)

Setting up shared folders is a useful way to transfer files from one operating system to another. To set them up, right click the little folder in the bottom right of the window.

Click Shared Folders to get a window:

Then click the little folder in the corner.

From the dropdown menu, click other.

This window will pop up. Create a new one or select an existing folder, and click OK.

For the Folder Name section, it should be automatically filled in with the name of the folder you selected. If you chose a folder with a long name or one with a space, you need to rename it to something WITHOUT A SPACE. Click OK and OK. This will set up a networked drive to the virtual machine. This shared folder will need to be set up every time you start the machine.

Creating Permanent Shared Folders (Step One, Windows and Ubuntu)

To make a shared folder that doesn’t disappear when you turn off thevirtual machine, you have to turn off the virtual machine and open the settings for that machine. Click the Shared Folder area at the bottom left.

Then click on the new Shared Folder button.

From there, make a new Shared Folder in the same style as before. Select a folder and name it something without a space. Click OK twice, and then access it using the instructions below.

Accessing Shared Folders (Ubuntu)

To set up the shared connection in Ubuntu, open up Terminal again. Type in sudo mkdir /mnt/[whatyouwantyoursharedfoldertobecalled]. Press enter.

Type in your password and press enter again. Nothing will appear to have changed. Now, type in sudo mount.vboxsf [nameofsharedfolder] /mnt/[nameyouwantedyoursharedfoldertobecalled].

Now, when you open up Computer and go to File System, open up mnt. There will be a folder in there called [whatyouwantedyoursharedfoldertobecalled] containing all the files in the folder you’re sharing. You can drag and drop into these folders from both the host and the guest.

Accessing Shared Folders (Windows)

Accessing Shared Folders in Windows seems a lot easier to me.  It may be that I’m used to Windows, but it sure seems a lot simpler. To use them, you’ll need to set up a shared folder all over again- they only are set up for one operating system.  After you have them set up, just open my Network Places from My Computer:

And click Add a network place under Network Tasks.

Click next and on “Choose another network location”.  In the box, type \\vboxsvr\[whatyourshareiscalled].

Click “Next”, give it a name, and you’re done!

Update: Part 3

Share this post

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

25 comments

  1. Harerton Dourado

    Hi again,

    When trying to setup the shared folder in ubuntu I can successfully create the directory with the “sudo mkdir /mnt/[whatyouwantyoursharedfoldertobecalled]” procedure. But when trying “sudo mount.vboxsf [nameofsharedfolder] /mnt/[nameyouwantedyoursharedfoldertobecalled]” I get the following message: “mount.vboxsf: mounting failed with the error: Protocol error”

    Any idea?

    Thanks!

  2. Harerton Dourado

    Hi,

    Great article.

    I installed CentOS linux in a VM but I couldn’t install guest additions from the indicated procedure.
    First I get a “no such file or directory” after typing cd /media/cdrom in the terminal window.

    Then if I access the contents of the cd by clicling on its desktop icon, choose to open a terminal windows in it and then run the “sudo ./VBoxLinuxAdditions-x86.run” command and type my password I get a message saying that my user name is not in the sudoers file.

    Any idea of what’s going on? I tried the same procedures in Ubuntu and it worked OK.

    Thanks!

  3. Wheezer

    Yet another great article! Thank you Locutus!

    I’m sitt’n at Starbucks right now downloading everything so I can take a shot at running a VM tonight when I get home, I have limited internet access at home.

    I’ve done like JeanJean and made a PDF of both articles. I figure by the middle of the night tonight, I’ll probably have this laptop so messed up I’ll have to trash it! Lol! Not really. With your great instructions I think I’ll be able to get it done ok.

    Thanks again, it’s definitively a plus to have you posting articles on dotTech.

  4. Samuel

    @Locutus: It doesn’t sorta intergrate with windows, it DOES intergrate with windows and yes it’s used my XP Mode. Slower I didnt notice and your complaints about intergrated mode are true but that because of how it does intergrated mode. in WVPC intergrated mode is really accessing the machine using a modified RDP link.

  5. Locutus
    Author/

    @Samuel: Is that the one that sorta integrates with Windows? The one that is used with XP mode? I kind of liked it, but it is way slower than VirtualBox. Plus, with integrstion features enabled, it only allows 16 bit color and the resize of the machine takes forever.

  6. haakon

    THANKS!!
    I will have to stay off from work for awhile.
    “Clean my brains” and DO this- set up a virtual.
    I have been running virtual machines on and off…but did not have the time or patience to try OR learn how to set up shared folders and so on.
    Your articles made me want to give it a new try!
    Thanks!!

  7. Locutus
    Author/

    @RobCr: The only cons I can think of:
    -While they’re running, they still use idle RAM and CPU like a real computer.
    -They tend to take up immense amounts of hard drive space.

    @o(o.o)o: Haven’t tried that yet- I’ll keep that in mind, thanks!

    @Karl: Sure, you can run these from external drives. Keep in mind, however, flash drives have limited read/write cycles. You may wear it out. Also, I read somewhere that if Windows isn’t restored to the same place on a hard disk, that it won’t run. I think it was the VirtualBox wiki. There were instructions on how to fix the problem too.

    @Samuel: Everything is easier than setting up shares it seems. That’s an annoying process!

  8. Karl

    Another excellent article on VMs! Thanks Locutus!!

    I am very excited about creating VMs out of my old XP laptops before they die and run them on my new Windows 7 desktop. So far I’ve only tried to create VMs from VHDs and run them on VirtualBox but wihtout much success. Using Disk2VHD with the Fix HALs for Virtual PC option off (didn’t get as far with it on) I’ve been able to create and start the VM but while it’s varifying the windows version it freezes. The processor that’s dedicated to it shows over 50% activity but it’s not spiked. Mouse and keyboard input doesn’t have any effect.

    I don’t know if the hardware arcitecture has anything to do with the problems (32 bit XP to 64 bit Win 7 running on an i7 processor) but, if anyone has any suggestions, please let me know.

    As a test I was going to run one XP VHD on the other XP laptop using VirtualBox but I don’t have enogh diskspace on the local/intrnal drive to fit the VHD. Is it OK to run a VHD from an external USB drive?

    Thanks in advance for any input,
    Karl

  9. RobCr

    Thanks for the 2nd part.
    I have only glanced so far (not planning to install them for a little while), so forgive me if you have already covered this.

    Could you clarify, any ‘Cons’ from doing this.
    (I would be installing XP Pro SP3 into the VM, and the real OS, in my real drive would be XP Pro SP3 )

  10. Ron

    Once again, mahalo nui loa! I just finished writing a paper and don’t have any wits left to get into this tonight. Tomorrow’s another day and I need to re-read the first part of the series again, anyway.