Thursday, July 9, 2009

Manually cloning Centos 4.x server to VMware ESX

To cut the number of physical PCs or Servers we need for our support and development work, we embark on testing out VMware solutions. One of the challenge is to migrate the existing physical installations (mostly Linuxes) into the VMware VMs. There are a number of options including using the VMware Converter. I chose to migrate it using HD cloning techniques.

To do this, I used g4u (a BSD based live CD) to make a clone of the physical server and store the compressed (GZIP) disk image in a FTP server.

Then I created a new VM in VMware with the same or bigger disk size as the original physical disk.

Next I again, boot the VM using the g4u ISO, and restored back the compressed disk image from the FTP server, and then reboot the VM. But the version of linux I was using, Centos 4.5, would not boot up properly. It complained that it could not find the volume group "VolGroup00". The problem was a driver issue and during the booting process it did not load the correct driver to recognize the "virtual machine" SCSI adapter.

After trying many options (changing virtual disk adapters, etc), I found an article to fixes the problem for the Centos 4.x linuxes at: http://tipstricksandmore.blogspot.com/2009/01/after-converting-physical-rhel4-system.html.

The VMware SCSI adapters uses the MPT SCSI drivers and so I needed to rebuild the initrd file to include these drivers so that the virtual disks can be seen during the boot up process.

This can be fixed by booting the VM using a rescue CD (I used SystemRescueCD), mounting the drive (don't forget to use the vgchange -ay to enable the volume groups), chroot to the disk, mount the /boot partition and then fix back the files and drivers, according to the article above.

Once done, the system booted up without problems.

Of course, if you had used the VMware Converter these problems may have been avoided but for those who wish to go via the "disk cloning" technique, remember to fix the disk drivers.

Booting from USB disk

On the older PCs there is no option to boot from the USB port. That is a predicament that I faced. The CD-ROM drive has failed and there is no built in network port.

With only a working floppy drive and USB ports, I used the PLop Bootmanager to install a boot manager which gives me options to boot from various devices (CD-ROM, HD, USB) even if the BIOS doesn't support.

Check it out at: http://www.plop.at/en/bootmanager.html

Thursday, May 7, 2009

How to install Windows 2000 using a Floppy and a Thumb drive

Recently an old Compaq Evo N160 laptop had a hard disk crashed. Worse still, the CDROM drive was not working. So how do you install back the Windows 2000 Pro on this laptop. I only had a working floppy drive and working USB ports but the laptop does not boot from the USB drive.

To install it, I first used another PC to copy the Windows 2000 Pro CD contents into a thumb drive.

Then I created a bootable MS-DOS 6.22 floppy disk. I copied over the following files to enable the laptop to access the thumb drive from DOS:

himem.sys - you can get these from the Windows 98se PC
format.com
fdisk.com
smartdrv.exe
usbaspi.sys - search the Internet
di1000dd.sys - search the Internet

Create a config.sys file on the floppy with the following contents:
device=himem.sys /testmem:off
devicehigh=usbaspi.sys
devicehigh=di1000dd.sys
LASTDRIVE = Z


Plug in the thumb drive and boot off the floppy from the N160.

Then, you will need to partition and format the hard disk (on FAT you can only get upto 2GB in the partition) using fdisk and format.

You will need to reboot the PC again.

Run the smartdrv program.

A:> smartdrv

Next, go into the thumb drive (which should be drive D:).

A:> D:
D:> cd i386

Then run:

D:> winnt

The Windows 2000 Pro installation should start. During the Windows installation, you will need to convert the existing 2GB partition to NTFS or alternatively, create a new NTFS Partitition to install the Windows 2000 OS.

Then you are done.