Friday 20 February 2009

Test disaster recovery (MBR curruption) of Redhat AS 4 on vmware workstation 5:

Test disaster recovery of Redhat AS 4 on vmware workstation 5:

Test Disaster Recovery Procedure:
1. Backing up MBR.
2. Currupting the MBR.
3. Booting off the Live CD.
4. Mouting root file system.
5. Restoring MBR from the backup in step 1.


Step 1: Backing up Master Boot Record (MBR)

What is MBR:
The MBR is a 512 byte segment on the very first sector of your hard drive composed of three parts: 1) the boot code which is 446 bytes long, 2) the partiton table which is 64 btyes long, and 3) the boot code signature which is 2 bytes long.

Using dd command we will be backing up the MBR which consists of 512 bytes.

What is DD:
Disk Definition (dd) came from IBM's Job Control Language and became a staple of the low-level UNIX and Linux commands. What dd does is copy bytes from an input source (if) to an output source (of). But dd can also copy raw data as well, which makes it perfect for copying boot sectors. The dd command can handle many tasks including: disk cloning (Note: Target disk must be of equal size or greater than the original disk)disk imaging,partition cloning, restoring from image file.

[root]# dd if=/dev/sda of=/backup_of_mbr bs=512 count=1
1+0 records in
1+0 records out
[root]#


For IDE devices: Its hda, for SCSI devices: its sda, check your scenario.

I have backedup MBR on the root. It's advisable to backup MBR to an external disk such as USB, CD or a differnt drive.


Step 2 : Currupting the MBR.

We will kill the MBR but leave the partition table intact by simply currupting the boot-code of 446 bytes of the total 512 bytes.

[root]# dd if=/dev/zero of=/dev/sda bs=446 count=1
1+0 records in
1+0 records out
[root]#

For IDE devices: Its hda, for SCSI devices: its sda, check your scenario.


Error on the reboot:

The master boot record (MBR) of this virtual machine's hard disk does not contain valid bootstrap code. It is likely that the MBR was corrupted by an incorrect guest operating system installation or some other reason. The virtual machine cannot continue and will now power off.

Step 3 : Booting off the Live CD or from an ISO image of the CD.

If you have a Live CD then simply insert the CD into the Drive and start the vmware machine. Note: make sure vmware has the control of the CD-ROM drive at this momment.

Or,

In case you have ISO image, then click on "VM" on the top menu bar of the vmware panel and select -"settings" | Click on CD-ROM under device | select "use ISO Image" | Browse to the ISO image of the Live CD.

Start the vmware machine.


Step 4: Mouting root file system.

a.You will be presented with redhat linux install options - In the command line Type : linux rescue [Enter]
b. Next sceen will ask you to "choose a language" , select "English" [Enter].
c. Select a keyboard type - choose "US" [Enter]
d. Do you want to start network interface on this system - Its up to you, i said NO b'cos i don't need a network, scope of this test is to Fix the currupted MBR.
e. You will now be presented with "Rescue" screen with following message :

The rescue environment will now attempt to find your linux installation and mount it under the directory /mnt/sysimage. You can then make any changes required to your system. If you want to proceed with this step choose 'continue'. You can also choose to mount your file system 'read-only' instead of read-write by choosing 'read-only'.

From the three options : Continue | Read-Only | Skip , Choose 'Continue', b'cos we want to mount the file system in read-write mode.


In the next screen "Rescue" , following message is displayed : Your system has been mounted under /mnt/sysimage . Press to get a shel. If you would like to make your system the root environment, run the command:

chroot /mnt/sysimage

Press [Enter]



Following message is displayed in the next screen :
Your system in mounted under the /mnt/sysimage directory. when finished please exit from the shel and your system will reboot.

-/bin/sh-3.00# [This is the shel you wil get, enter the following command]
-/bin/sh-3.00# chroot /mnt/sysimage


sh-3.00# [Now you are back in business, just type 'ls' to get the list of items and to see the backup file you created in step1].

sh-3.00# ls [Enter]
backup_of_mbr boot halt lib misc proc selinux tmp
backup dev home lost+found mnt root usr
bin etc initrd media opt sbin sys


You can see the backup file 'backup_of_mbr' up there...

Note: I hope you remember i saved the backup file 'backup_of_mbr' on the root itself that is - "/".

Step 5: Restoring MBR from the backup done in step1.

At the following shel type :

sh-3.00# if=backup_of_mbr of=/dev/sda bs=446 count=1
1+0 records in
1+0 records out
sh-3.00#



Finally, remove the "live cd" or "ISO image" and type "exit" at the shel command, and once again type 'exit' as shown below:

sh-3.00# exit [Enter]
-/bin/sh-3.00# exit [Enter]
logout..
rebooting the system....



That's it - You are back in business, your linux will boot off normally as if nothing happend. This was a very small excercise to demonstrate how to overcome currupt MBR issues as long as you have a proper backup of the same. Iam a beginner in linux hence there may be mistakes which i don't know untill someone points to me but i hope i will learn as i grow further.

Wednesday 21 January 2009

Free VMware Workstation without the need to create your own virtual machine:

To help you get the most out of your free evaluation of VMware® Workstation, here is the quick easy way to get your first virtual machine up and running.

Try VMware Workstation without the need to create your own virtual machine, you can download a free "virtual appliance" with Linux .

Download a free "virtual appliance: (Linux OS + Firefox browser pre-installed)

http://www.vmware.com/appliances/directory/80?src=EM_08Q4_VMW_OTHER_WORKSTATION-EVAL-CAMPAIGN_EM2&ossrc=EM_08Q4_VMW_OTHER_WORKSTATION-EVAL-CAMPAIGN_EM2&elq=C1416441A8CA488BA692DCEE197DB9BA

Courtesy:VMware

Wednesday 14 January 2009

What is virtualization ? By, Vmware.

Virtualization is a trend that is sweeping enterprise IT across the globe. Overall 7 million servers are shipped every year world wide. Out of those 6 million servers are Intel Architecture X86 and these are getting deployed in the enterprise data centres world wide. In a traditional environment there are single application running on single OS on a single machine and they are sprawled across the data centres, this leads to a tremendous cost in the number of areas - in terms of Hardware, data centre facility cost, interms of operational maintainance and management cost.


To address this overwhelming pressures, what enterprise IT has found is the most compelling tool called "Virtualization Technology" (VT). Across these millions of single servers the average utilization is just about 5-10%. This indicates they are barely utilized to its capacity. So what VT does it allows you to take advantage of this under utilized resources as well as the fine granined technology to RUN these envrionments side by side on much lower number of PHYSICAL SERVERS. To illustrate this, we take these environments it could be databases, webservers, e-commerce application, business application and you take them and consolidate them into much smaller number of physical servers. Each of these environment now runs side by side on a single machine and each of them is fully isolated and encapsulated.

What that means is - There is a Hardware Layer and top of it is the "Virtualization Layer" that enables all this and on top of this you have each of these environments whether it is databases,webservers ,business applications etc. They all have their separate operating-system (It coud be UNIX, LInux, Windows, Solaris etc) and on top of this runs each of this applications side by side on the single machine. The most facinating this is that - each of this virtual servers has its own CPU, memory, ethernet Nic, disk. They all run in a isolation just as they would run in a physical enviornments.


What all this means to IT companies is - Tremendous savings. Earlier IT organizations use to run 800 servers for various applications are now able to consolidate that down to just 60 servers. ROI is tremendous.

In addition to that, it also completey changes how customers can provision their application, their server environments. For example - How you initiated new server, new applicaiton softwre earlier...? Putting this out into your data center took number of weeks - to procure the hardware, to install the OS and then patch it with service packs, install the application and confifure that. Phew!!!!

Now all these is a software, hence initiating this is a matter of minutes.

Basic's of storage networks (An insight into - How we got to, where we are today..')