Wednesday, June 20, 2012

Creating An Amazon EC2 From A Running Instance

Follow below given link, its very good article:

http://webkist.wordpress.com/2010/03/16/creating-an-amazon-ec2-ebs-ami-from-a-running-instance/

Otherwise after completion of Step 2 in above link follow below steps:

1) Go to Amazon Management Console

2) Go to EC2 Dashboard

3) Go to Volumes Panel (which is in left side)

4) Right Click on the Volume where image has been copied

5) Click on "Create Snapshot"

6) Click on Snapshot Panel ( which is in left side and after Volume Panel)

7) Select Snapshot which is just created and then Click on the "Create Image" button just above the list of Snapshots

8) This will ask for RAM Disk and Kernel ID (copy from the Actual image description)

9) Click on "Create Image"

Thats it!!!

Wednesday, June 9, 2010

Virtualization With XEN


Virtualization is a concept for running Guest Machines over a Host Machine.


We know now a days virtualization is a global concept for cost saving. We do not need buy/run multiple hardware for multiple Machines/Server's which is called Green IT.

If we are running multiple hardware for multiple Server's that increases cost to Hardware in IDC. For the purpose of High Availability we uses multiple networks card, power supply and many more but in case of Virtualization all Guest machines are running over one physical hardware so, do not need multiple devices for multiple Guest Machines.

So, now we are going to talk about installation and configuration of XEN Virtualization Server over CentOS 5.2.

Xen is hypervisor which allow multiple machines to run over single Hardware.

XEN supports following types of virtualization:

1) Full Virtualization
2) Para-Virtualization

Full virtualization provides total abstraction of the underlying physical system and create a complete virtual system in which the guest operating system can execute. No modification is required in the guest operating system or application; the guest OS or application is not even aware that it is running within a virtualized environment. The guest OS executes on the VM just as they would on a physical system. This approach can be advantageous because it enables complete decoupling of the software from the hardware. As a result, full virtualization can streamline migration of applications and workloads between different physical systems. Full virtualization provides complete isolation of different virtualized applications, which makes this approach highly secure by design. Microsoft Virtual Server and Vmware ESX Server are examples of full virtualization.


However full virtualization may incur performance and resource penalty.


Para-Virtualization presents each Guest/Virtual machine with an abstraction of the hardware that is similar to but not identical to the underlying physical hardware. Para-virtualization attempts to provide most services directly from the underlying hardware instead of abstracting it. Para-virtualization allows for near-native performance.
Para-virtualization requires modifications to the guest operating systems that are running on the VMs. As a result the guest operating systems are aware that they are executing on a VM.

For running Xen Virtualization we need XEN kernel to be installed over OS.

As well we can use Virtual Machine Manager (VMM) for managing Xen Hypervisor.

Installing Xen

yum -y install kernel-xen virt-manager libvirt-devel

Now boot OS over Xen Kernel.

Now we can manage Xen with VMM. Use following command to run VMM:

virt-manager

Domain-0 :- The first domain, automatically started at boot time. Domain-0 has permission to control all hardware on the system, and is used to manage the Hypervisor and the other domains.

This will open VMM console.

We can install OS using VMM console or following command:

virt-install -n CentOS -r 256 -f /opt/CentOS.dsk -s 5 --vnc -p -l http://localhost/path/to/centos/DVD

Above command will install CentOS with following options:

-n Name of the Guest Machine (In our case CentOS)
-r RAM to be assigned to the Guest Machine
-f Destination to store Guest OS disk file
-s Size of Guest machine HDD (In our Case 5 GB)
--vnc Run over VNC view
-l Path/URL to Source Installation Directory

Above command will start installation and ask questions regarding installation.

Here are the following commands related to Xen:

virsh list                                     List running Guest Machines (use --all for all)
virsh dominfo guestname            Show guest machine info related to memory, cpu etc..
virsh shutdown guestname          Shutdown/restart/autostart/pause/save Virtual Machine

If we want to add storage to the Virtual/Guest Machine, use following commands over Host Machine:

Create a partition, lets say /dev/sda5 using fdisk command.

Attach partition to Guest Machine:

virsh attach-disk VMName /dev/sda5 xvdd        XVDD is Partition/Storage Device name over Guest Machine to be added as.

After running above command goto Guest machine format the partition and mount partition /dev/xvdd. If we restart Guest machine, partition will be unmounted so that we need to add storage/partition permanent. For that we do following:

Guest machine configuration files will be stored in /etc/xen/CentOS

Change following line into above file:

disk = [ "tap:aio:/opt/centos.dsk,xvda,w" ]
to
disk = [ "tap:aio:/opt/centos.dsk,xvda,w", "phy:sda5,xvdd,w" ]

Option : phy:sda5,xvdd,w
phy    ------> Physical Partition
sda5  ------> Source Device
xvdd  ------> Destination Device for Guest Machine
'w'     ------> option means read/write.

Thats it for now. If missing something, please let me know.

If want to ask something, please let me know. ;-)