Showing posts with label virtualbox. Show all posts
Showing posts with label virtualbox. Show all posts

Wednesday, September 21, 2011

Combining Dropbox and Virtualbox

Two of my favourite pieces of software at the moment are Dropbox and Virtualbox, both free and easy to setup.

If you find yourself using multiple Virtual Machines it may be useful to use Virtualbox's Shared Folders feature and point this to your Dropbox.  Nice if you have a set of testcases that you want to run on multiple OS'es.

So assuming you have a Windows Host and Solaris guest :

Create a shared folder in VirtualBox, point the share to your Dropbox folder, in my case "My Dropbox" which is on the desktop.

Call the share "Dropbox".

Start the Solaris VM.

Open Terminal.

login as root:

cd Desktop

mkdir Dropbox


mount -t vboxsf Dropbox ~/Desktop/Dropbox

For Ubuntu VM's you can download the Dropbox client or try this as root:

sharename="Dropbox"; 
mkdir /mnt/$sharename \
chmod 777 /mnt/$sharename \ 
mount -t vboxsf -o uid=1000,gid=1000 $sharename /mnt/$sharename \
ln -s /mnt/$sharename $HOME/Desktop/$sharename


ZFS and Virtualbox

Below are step by step instructions on setting up Virtualbox on Solaris10 and using zfs to clone.

Setup:

Solaris 10u8b5 installed on machine with 4 gig RAM and duo core processor.
Downloaded Latest Virtualbox from here: http://www.virtualbox.org/wiki/Downloads to /opt

Step 1: Install Virtualbox.
  1. cd /opt
  2. tar -xvf VirtualBox-3.0.4-50684-SunOS.tar
  3. pkgadd -d VirtualBoxKern-3.0.4-SunOS-r50684.pkg
  4. pkgadd -d VirtualBox-3.0.4-SunOS-r50684.pkg
Step 2: Setup zfs filesystem. This machine only has one hard drive so we make a zfs filesystem under UFS.
  1. cd /export/home
  2. mkfile 30000m vpool
Create SWAP space under ZFS: (Use roughly double the physical RAM)
  1. zfs create -V 10gb vpool/swap
Create the ZFS vpool
  1. zpool -f create vpool /export/home/vpool
Create an area to put the GOLDEN image:
  1. zfs create -V 15g vpool/GOLDEN_IMAGE/
Step 3: Get a GOLDEN image from net10-bambi.
  1. cd vpool/GOLDEN_IMAGE/
    #ftp <golden image repository>
    usual password.
  2. cd /export/vm_images/GOLDEN_images
  3. bin
  4. get Windows7_x86_b7229_vb_GOLDEN.vdi.tar.gz
  5. bye
  6. gunzip Windows7_x86_b7229_vb_GOLDEN.vdi.tar.gz
  7. tar -xvf Windows7_x86_b7229_vb_GOLDEN.vdi.tar
(Ideally at this point you should create a VM and point to the GOLDEN image, start the VM and update the GOLDEN with any patches/updates etc you need. Then stop the VM.)

Step 4: Cloning.
Ok we have the GOLDEN image now we can clone.
First we snapshot the GOLDEN image:
  1. zfs snapshot vpool/GOLDEN_IMAGE@golden
Then we create an area for TEST_IMAGE
  1. zfs create vpool/TEST_IMAGE
And then we clone:
  1. zfs clone vpool/GOLDEN_IMAGE@golden vpool/TEST_IMAGE/disk_image1
  2. zfs clone vpool/GOLDEN_IMAGE@golden vpool/TEST_IMAGE/disk_image2
  3. zfs clone vpool/GOLDEN_IMAGE@golden vpool/TEST_IMAGE/disk_image3
Change the uuid of each disk:

VBoxManage internalcommands setvdiuuid /vpool/TEST_IMAGE/disk_image1/Windows7_x86_b7229_vb_GOLDEN.vdi

VBoxManage internalcommands setvdiuuid /vpool/TEST_IMAGE/disk_image2/Windows7_x86_b7229_vb_GOLDEN.vdi

VBoxManage internalcommands setvdiuuid /vpool/TEST_IMAGE/disk_image3/Windows7_x86_b7229_vb_GOLDEN.vdi

Each of these disk_images is very small and only grows as the VM is used.

Step 5: Create VM.
This has been covered in previous emails/blogs so I wont cover it again. Basically just create your VM's, select "existing disk" and point it to one of the disk_images in Step 4.