Wednesday, December 23, 2009

Clone or Copy a VirtualBox Virtual Disk

Clone or Copy a VirtualBox Virtual Disk

Published by Nick Heppleston on Wednesday, 17th June 2009 in VirtualBox and Virtualisation. 7 Comments

As a virtual machine environment user, I regularly create ‘base’ images of machines that I can reuse – a base Windows Server 2003 environment, or SQL Server 2005 environment for example. That way, when I need a new machine, I can simply create a copy of the virtual disk and add any additional software I need, saving myself valuable time creating new virtual environments.

With VMWare’s various offerings, copying a virtual disk is easy: copy the disk in Windows Explorer and add it to a newly created VM; VMWare will detect that the disk was a copy and create a new unique identifier (UUID) for the disk before adding it to the VM. Easy and painless. Not so with VirtualBox.

With VirtualBox, copying a virtual disk is a bit of a pain. If you copy the disk in Windows Explorer and try and use it in a new VM, VirtualBox will have a hissy fit and display the error shown below. A bit of a ‘wordy’ way to say that it already knows about this disk, don’t you think?


The publicised way around this is to use the command-line VBoxManage CloneHd tool, however there is another – secret and undocumented – way to clone a disk: the setvdiuuid tool. Lets look at these two methods in detail.


Cloning a Virtual Disk – The ‘Supported’ Method

Cloning a disk is (IMHO) a clunky and Unix-y type way of creating a duplicate disk. We need to invoke the CloneHd command of the VBoxManage tool, supplying the disk to clone and the name of the new ‘cloned’ disk. In its simplest form, you would do something like this at the command-line:

cd C:\Program Files\Sun\VirtualBox

VBoxManage clonehd "DiskToClone.vdi" "ClonedDisk.vdi"


The VBoxManage tool will chug away and clone the disk for you, creating a new UUID in the process:

The cloned disk can now be used on a new VM without incurring the ‘I already know about this disk’ error.



Copying a Disk – The ‘Unsupported’ Method

The unsupported method is to copy the disk like you copy a normal file and then set a diferent uuid
using setvdiuuid.

Setvdiuuid is an undocumented option available in VBoxManage – the setvdiuuid command. As the command help states: ‘This is a development tool and shall only be used to analyse problems. It is completely unsupported and will change in incompatible ways without warning’. Because of this, let me add a little disclaimer: I don’t accept any responsibility if you completely destroy your VM using this procedure. Having said that, it appears to work without issue, so I’m more than happy to use it myself – just make sure that you take a backup of you virtual disk before using it if necessary.

To use the tool, simply create a copy of the virtual disk’s VDI file in Windows Explorer; open the Windows command-line and issue the setvdiuuid command for the newly copied disk:

cd C:\Program Files\Sun\VirtualBox

VBoxManage internalcommands setvdiuuid "CopiedDisk.vdi"

The tool will create a new UUID and assign it to the disk:

The new copied disk can now be used on a new VM without incurring the ‘I already know about this disk’ error.

This was shown for windows but also works on linux, you just need to change cd C:\Program Files\Sun\VirtualBox to the correct location on linux.



Wednesday, December 16, 2009

Installing Magento - Shopping Cart

Magento HOWTO


# Install Apache With It's Documentation #####

$ sudo apt-get install apache2 apache2-doc

# Start Apache (it should already be started) #####
$ sudo /etc/init.d/apache2 start


# Test Apache #####

Type on Mozilla Firefox: http://127.0.0.1/
It souhld read: It works!

Note: The message "It works!" can be found at the /var/www
directorie, which is apaches's root directory, wich is were
we will install Magento.



# Instaling MySQL and PHP necessary Dependencies #####


$ sudo apt-get install mysql-server mysql-client
Type in mySQL's root password in the upcoming textbox.

$ sudo apt-get install libapache2-mod-php5 libapache2-mod-perl2

$ sudo apt-get install php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-imap php5-ldap

$ sudo apt-get install php5-mhash php5-mysql php5-odbc curl libwww-perl imagemagick

$ apt-get install php5-mcrypt

# Creating Magento MySQL Database #####

$ mysql -u root -p

mysql> create database magento;

mysql> exit



# Extract Magento #####

$ cd /home/user/Desktop/magento

$ unzip magento.zip



# Installing Magento in Apache #####

# Copiar o Magento para /var/www (apache root dir)
$ sudo cp -vr magento /var/www



# Give Apache Ownership Over SugarCRM Files (apache-user: www-data) #####

$ sudo chown www-data -vR /var/www/magento*



# Configuring php.ini #####

sudo gedit /etc/php5/apache2/php.ini


;memory_limit = 16M
memory_limit = 64M


# Restart Apache #####

$ sudo /etc/init.d/apache2 restart



# Delete Apache's Test Page #####

$ sudo rm -rf /var/www/index.html


# Configuring Magento #####

Type on Mozilla Firefox:
http://127.0.0.1/magento/install.php
and configure Magento acording to the presented instructions.



Other Shopping Carts Reviews

http://webtecker.com/2008/04/22/8-best-open-source-shopping-cart-solutions/
http://www.siteground.com/shopping_cart_reviews.htm