Archive for the ‘Manuals & How-To’s’ Category

Backing Up ESX and vSphere Host Configurations with the Host Profile Feature

May 5, 2010

Back before vSphere, some very creative people/companies created utilities to backup all of the host configuration on your ESX servers. Things like Networking configuration, vSwitch configuration, Port groups, etc. Now with vSphere, how do you protect this information in case of a host failure/reinstall? Answer: Host Profiles.

It’s not really a “backup” per se, yet Host Profiles greatly simplify host configuration management in scale-out deployments through user-defined configuration policies. You can use profile policies to eliminate per-host manual host configuration and efficiently maintain configuration consistency and correctness across the entire datacenter.

An excellent recent post with additional links and such about Host Profiles can be found here:
http://communities.vmware.com/message/1376450;jsessionid=4944184E8F195FF105DF0BCF31114226

A great “how-to” type of blog post with Host Profiles can be found here:
http://malaysiavm.com/blog/esx-host-profiles-with-vsphere/

Hope it helps!

VMware vSphere – Using VMware Converter to Import VM’s or VMDK’s From Other VMware Products

December 22, 2009

When using Virtual Machines (VM’s) from other VMware products, the easiest way to get these VM’s into ESX/vSphere is to use VMware’s product called vCenter Converter Standalone. vCenter Server does include a version of Converter, however I’ve had better success in using the standalone version to do VM conversions as it is (typically) a newer version with more features than the one included with vCenter. This lesson describes how to use vCenter Converter Standalone to import VM’s or VMDK files from other VMware Products, such as VMware Fusion, VMware Workstation and VMware Server.

Powering On VM – Error with VMDK Files

media_12615190381091.png

We experienced the shown error when trying to power on a few virtual machines from a vendor of ours. I assumed that the VM’s were in ESX/vSphere format, but I guess they are not. It looks like we’ll need to convert the VMDK’s to the ESX/vSphere format so that we can use them.

Error Message:
Failed to find a host for powering on the Virtual Machine. The following faults explain why the registered host is not compatible.
Device ‘Hard Disk 1′ uses a controller that is not supported. This is a general limitation of the virtual machine’s virtual hardware version on the selected host.
Device ‘Hard Disk 2" has a backing type that is not supported. This is a general limitation of the virtual machine’s virtual hardware version on the selected host.

Verifying the VMDK is not in an ESX/vSphere Format

media_12615198996561.png

We SSH’ed into the vSphere server and browsed to the VMFS datastore that holds our Virtual Machine. As shown in the screenshot, we can tell the VMDK is not an ESX/vSphere compatible VMDK for the following reasons:
1- There is no "-flat.vmdk" file, which all ESX/vSphere type of VMDK’s should have.
2- There are VMDK "slices" as shown in the screenshot (1). ESX/vSphere VMDK’s do not use this type of disk format (where other VMware products such as Workstation and Server do).
You can use VMware Converter to fix this issue by converting the VM to an ESX/vSphere compatible VM.

IDE VMDK – Not Supported in ESX/vSphere

media_12615190690251.png

An error that you might receive when using a VM from another product is:
An IDE controller is found but the virtual machine does not support the option.
The reason that this fails is that ESX/vSphere does not support IDE based Virtual Disks (VMDK’s) like the Desktop/Hosted products do. You can use VMware Converter to fix this error by converting the VM to an ESX/vSphere compatible VM.

Flat Backing Option Not Found

media_12615191101771.png

An error that you might receive when using a VM from another product is:
A flat backing option was not found.
The reason for this error is that ESX/vSphere is looking for a virtual disk file (VMDK) that actually points to a -flat.vmdk file. The Desktop/Hosted products do not use this type of Virtual Disk but ESX/vSphere does. You can use VMware Converter to fix this error by converting the VM to an ESX/vSphere compatible VM.

Sparse Backing Info Disk Option Not Found

media_12615191505821.png

Another error that you might receive when using a VM from another product is:
A SparseVer2BackingInfo disk is found but the virtual machine does not support the option.
This error is shown because this virtual disk uses a "sparse" feature on the virtual disk, so as not to take up a lot of space on the drive. Usually the VMDK file will also be "split" into multiple VMDK files that end in a -0001, -0002 and so on. This is done to limit the size of the VMDK. ESX/vSphere does very similiar options with VMDK files however it is done differently. This is the reason for the error shown. You can use VMware Converter to fix this error by converting the VM to an ESX/vSphere compatible VM.

Download VMware vCenter Converter Standalone Edition

First you’ll need to get vCenter Converter Standalone, which is available for FREE at the following location:
https://www.vmware.com/tryvmware/?p=converter
Once you’ve downloaded the program, install it on a server that you can use for the migrations. I usually install it on my vCenter server but that’s not a requirement. Once installed, go ahead and start vCenter Converter Standalone.

Convert Machine

media_12615201488971.png

Once the program starts, choose "Convert Machine" to get started.

Selecting Source for Conversion

media_12615202424811.png

First, select the source type, which in our case will be a "VMware Workstation or other VMware virtual machine" (1). Then browse to where the virtual machine is located at (2). This will need to be on a network share or on a local drive so that Converter can access the files. Then choose the Next button to proceed (3).

Selecting Destination for Conversion

media_12615203513691.png

Select the destination type, which in our case will be a "VMware Infrastructure Virtual Machine" (1). Then specify either an ESX/vSphere server or a vCenter Server along with the required login information for that host (2). Then select "Next" to proceed (3).

media_12615206035951.png

Now, specify the Virtual Machine name (1), the destination Datastore (2) and then click "Next" to proceed (3).
Note, that if you use "Version 7" for the Virtual Machine hardware version, you will not be able to use this VM on anything but vSphere 4. If you need to use this VM on ESX 3.x then choose "Version 4" for the Virtual Machine hardware version.

VM Options

media_12615207019091.png

This screen will show various options that you can specify for the newly created Virtual Machine. Your options may differ or you may want to change a few thinggs here depending on your environment. A couple of options that I normally select is under "Advanced Options" (1). Select the option to "Power on target Machine" (2) and to also "Install VMware Tools on the imported Virtual Machine" (3). This will automatically startup and install VMware tools on the new virtual machine after the cloning process is finished. Next, click on the "Next" button (4) to proceed.

Wizard Summary

media_12615207533281.png

A summary screen is displayed. If you need to edit any of the options on this screen, you’ll need to back up through the wizard to that specific area. If you are ready to proceed, click on the "Finish" button to begin the conversion process.

Running Conversion

media_12615207966911.png

You can check the status of the conversion by following the "Status" area for the conversion job. You can also use the "Task Progress" tab to see more detailed information about the conversion.

Conversion Completed

media_12615228454461.png

Once the conversion is completed, you’ll see the status of the job change to "Completed".

media_12615229446591.png

Now, you can use the vSphere Client to log into your vSphere (or ESX) environment and you will see your newly created Virtual Machine, which has already been powered up successfully.

How-To : Running the vSphere 4 Client on Microsoft Windows 7 (RTM/Retail)

October 22, 2009

Running the VMware vSphere 4 client on a Windows 7 machine just doesn’t seem to work. After the Windows 7 RTM version was released, we could use the vSphere Client to connect to an ESX 3.5 host with no problems. However you still cannot connect to a vSphere 4 host. This lesson describes how to "fix" this issue with a workaround that was presented on the VMware Community Forums (thanks to all on that post!). This is a simple and concise way of implementing the "fix" without having to do a lot of changes to your system (some other blogs have shown the more "difficult" route to accomplish this same thing). What is nice about this method is that it’s easily removable and doesn’t change any system settings permanently.

The Error

media_1256236923217.png

Here I will show the error when connecting our vSphere client to a vSphere 4 server.

media_1256236944803.png

Here is a screenshot of the error. It reads:
Error parsing the server "192.168.70.199" "clients.xml" file. Login will continue, contact your system administrator.
When you click on the "Ok" button, you will get the following error.

media_1256236966000.png

This error reads:
The type initializer for ‘VirtualInfrastructure.Utils.HttpWebRequestProxy’ thew an exception.

The Workaround Fix

We have pre-packaged the files that are needed to "fix" (e.g. workaround) this issue.

Download only ONE of the files below per the version of Windows 7 you are using (e.g either 32bit or 64bit).

http://lewanps.files.wordpress.com/2009/10/viclient4_fix_win7-x32-zip.doc (for 32bit)
http://lewanps.files.wordpress.com/2009/10/viclient4_fix_win7-x64-zip.doc (for 64bit)

Our blog system won’t allow .zip files so I renamed the files to .doc. Once you download correct file above, RENAME the file to end in a .zip extension and then proceed with the next steps below.

media_1256240056649.png

Once you have renamed the file, right click on the file and select "Extract All".

media_1256240148714.png

Next, extract the files to the location below:
For 32bit, extract to: C:\Program Files\VMware\Infrastructure
For 64bit, extract to: C:\Program Files (x86)\VMware\Infrastructure
In our screenshot, we’re extracting to a 32bit system.
Check the box that says to "Show extracted files when complete".

media_1256240184229.png

You will get a few "Confirm Folder Replace" options. Check the box that says "Do this for all current items" and then click on the "Yes" button to continue.

media_1256240212912.png

Now select the "Do this for the next conflicts" checkmark. Then select the "Copy and Replace" option. We are basically replacing 2 simple configuration files for the vSphere client and for Update Manager. The changes are simple and easy to remove once this issue has been resolved by VMware.

media_1256240246072.png

Next select the checkmark for "Do this for all current items" and then select the "Continue" button. Windows is asking for "admin level" permission to replace the files that we told it to in the previous step.

New Program Links

media_1256240290342.png

After the extraction happens, a box will appear like the one in the screenshot. The two links for the vSphere Client and for the vSphere Update Client are NEW links that will need to be used to launch either program. Feel free to copy these links to your desktop or Start Menu. You MUST use these new links in order for the clients to work.

Connected!

media_1256240816575.png

Launch the vSphere Client using the link described in the previous step. Type in your vSphere Servers’ IP address, your login and password, and viola! you should now connect. Once connected, you can click on the "Inventory" link to see the vSphere server.

media_1256241008122.png

Here is your vSphere server, using the vSphere Client on Windows 7!

How-To: Make ISO’s from the ESX/vSphere Service Console

July 11, 2009

Since you can mount ISO files as a “CDRom Device” inside VM’s, the common question that normally will come up is, “How do I make ISO files from my existing CD’s?” There are a number of ways to do this however you can use ESX to make the ISO images and then store them either locally on the ESX server or on a SAN attached VMFS. I would recommend putting them on a SAN attached VMFS volume so all of your ESX servers can access them.

Connect via SSH and Make ISO

media_1231184205175.png

The first step is to put the CD in the physical CD reader on the ESX hardware.

Now, SSH into the ESX server (as described under "Connecting via SSH/CLI" in this guide).
Next, type in the following command (also shown in the screenshot):

dd if=/dev/cdrom of=/vmfs/volumes/vmfs_name/filename_for_cd.iso

Replace "vmfs_name" with the actual name of your VMFS datastore.
Replace "filename_for_cd" with the actual name that you want to use for the ISO you are creating.

Browse for ISO

media_1231187598311.png

Now go to that directory where you pointed the “of” (or output file) and you should be able to see your ISO image as shown in the screenshot. Now you can use this ISO file as a CD-ROM device in your Virtual Machine by editing the properties of the virtual machine and pointing the CD to the datastore ISO you created.

How To Collect Data From a Fibre Channel (FC) Switch

June 15, 2009

Sometimes you will be asked by either the manufacturers support or perhaps by Lewan for data from your Fibre Channel switch. Here is how you can gather that information in a format that helps support and/or Lewan:

Brocade – How-To Collect a “supportshow” from a Brocade Switch from a Windows Host with HyperTerminal
Follow these steps:

  1. Start the HyperTerminal program by selecting Start -> Programs -> Accessories -> Communications -> HyperTerminal.
  2. Make a new connection and select a name and icon for the connection.
  3. A “Connect to” window is displayed.
  4. Change the Connection using modem to TCP/IP (Winsock) and enter the IP address of the Brocade switch.
  5. Click the OK button.
  6. Log in to Brocade switch (default user: admin/default password: password), and then start to capture text. Select Transfer -> Capture text -> File C:\supportshow.wri.
  7. Run the Brocade supportshow command.
  8. After the command completes, stop the “capture text” process (Transfer -> Capture text -> Stop).
  9. After completing this for all switches in all related fabrics, type quit and close the HyperTerminal session.

Cisco Support Logs

To capture support logs for a Cisco FC switch, following these instructions:

1) For firmware 1.2(x) and above telnet to the switch and open a capture session.
2) Run the following commands:
    term len 0
    show tech-support details
3) For firmware 1.0(4):  There is not a single command like a supportshow or data collection. There are two ways to get the outputs needed to troubleshoot most Cisco switch issues. Contact Lewan for additional information.

McDATA Switch Data Collection

In order to collect data from a McDATA switch being managed by McDATA’s EFCM utility, follow these instructions:

  1. Select the switch that you want to collect data from.
  2. Select Maintenance and then Data Collection.
  3. Enter a file name to call the file and then select save. Note the directory where the data is saved.  Once you select save, the data collection takes over and the files is downloaded to the local PC and stored in the directory specified.

How to collect switch information and related data from a McDATA DS-16M, DS-32M or another switch with EWS:

These switches (also known as ES3016 and ES3032)  have an Embedded Web Server (EWS) GUI. You can access this through a web browser by entering the IP Address in the URL address line  (that is, http:/10.14.1.92).  Once you have logged in you can run a script that collects switch information including: Network Info, Operating Parameters, Zone Info, Port Login Data, Port Data and Port Types, and Switch Status.

Note:  These model switches do not support serial port connectivity for information retrieval.

To collect this information, follow these steps:

  1. Once you have logged in to the EWS GUI, click on ” Operations ” from the left frame of the EWS GUI.
  2. Click the third tab called “Maintenance.”
  3. Click the secondary tab labeled Product Info.
  4. Click Product Information. This will generate a report.
  5. Click “File” on the web browser toolbar and select “Save As” to save the .txt file with either the default name or one that you rename it to. Save it on the desktop or to a directory where you can locate it so that you can email it to Technical Support.

To locate the switch firmware revision, follow these steps:

  1. Click “View” from the left frame of the EWS GUI.
  2. Select Unit Properties. The last entry of that page has the firmware level.

Lefthand Networks How-To : Reset Storage Module Password

March 23, 2009

Lefthand Networks storage modules have an admin password which is needed to log into the storage module and to change any settings. In case you forget this password, this How-To explains how to reset the admin password through the console. Thanks to Jason H. in Wyoming for logging a support call and sharing this useful info with us.

Connect a Console to the Storage Module

media-1237820554055.png

For the storage module that you would like to reset the password on, connect a console connection to that module (monitor, keyboard, mouse). You’ll see a screen like this one.

Start the Admin Interface

media-1237820578456.png

Type in: start to start the configuration console interface.

Enable Reset Password Option at Login Screen

media-1237820600147.png

This is the step where you can hold down the SHIFT button and type in LHN
This will give you more options at the login screen as shown in the step below.

Select Reset Password Option

media-1237820711474.png

The “Reset Password” option will now appear under the Login screen which you can select by using the arrow keys to select the Reset Password option and press Enter.

Reset Admin Password

media-1237820748065.png

Type in the new admin login (the default is: admin) and a new password for that login and use the tab key to select the Ok option and press Enter.

Reset Admin Password – Confirmation

media-1237820896644.png

Once you receive a confirmation, the admin password has been reset. You can now use the new login information to login or make edits to the storage module/management group.

How-To: Setup SNMP on ESX 3.5 Servers

February 23, 2009

To monitor your ESX 3.5 server by using SNMP, we need to enable SNMP on ESX before adding it to your monitoring software. This How-To will show you the steps involved.

 

Log Into ESX Server

media-1235427473105.png

Log into your ESX Server either through SSH or through the console of the server.

Use Nano to Edit Snmpd.conf

media-1235427595706.png

Use Nano (which is a notepad like text editor) to edit the file /etc/snmp/snmpd.conf file by using the command:
nano /etc/snmp/snmpd.conf

Add SNMP Community to Config File

media-1235427774660.png

Use the arrow keys to go down to the section “rocommunity public”. Replace “public” with your community string for your environment (1). Then use “Ctrl+X” to exit out of Nano. You’ll be asked if you would like to save. Type in “y” for yes and hit enter. Press enter again when confirming the filename to save as.

Enable SNMP to Start Automatically After a Reboot

media-1235428097675.png

Since SNMP is not started by default, you’ll need to type in this command to ensure it will be started after a reboot of the ESX server. The command is:
chkconfig snmpd on

Enable SNMP Through the ESX Firewall

media-1235428204838.png

We’ll need to allow SNMP traffic through the built-in ESX firewall. To do this, type in the following command:
esxcfg-firewall -e snmpd

Start the SNMP Service

media-1235428286191.png

Now we’re ready to start the SNMP service. Type in:
service snmpd start

Ready for Monitoring

At this point, SNMP is enabled on your ESX 3.5 server and you can monitor it using your SNMP monitoring software! Happy monitoring!

See Hidden Devices In Windows on Converted VM’s

February 10, 2009

Whenever performing a P2V (Physical to Virtual) process, you’ll usually have some devices that are left over in the system which are no longer present. It is best practice to remove these devices from the VM so that it is no loading unnecessary drivers for hardware that’s been removed.

To see hidden devices through Device Manager that are no longer present in the system, follow these steps:

Open up a command window and type in:
SET DEVMGR_SHOW_NONPRESENT_DEVICES=1

Then start device manager from the same command window by typing in:
devmgmt.msc

Choose the option “Show Hidden Devices” under the “View” menu.

Go through the different hardware sections and look for greyed out devices (which represents that they are no longer present in the system) and right click on the device and choose “Uninstall”. This will remove the greyed out device permanently.

Happy converting!

VMware – Enable SSH by Root and Connecting via SSH (CLI)

February 4, 2009

ESX 3.5 has a command line interface called the Service Console, which you can SSH (Secure Shell) into in order to manage ESX or to run commands/scripts. This is how you connect to ESX 3.5 via SSH.

Why Can I Not Login as Root Automatically?

By default, SSH is turned on for ESX 3.x installations however the “root” user is denied from logging into the server as a security precaution. We will need to enable the root user to login by editing a configuration file and restarting the SSH services to take into effect the change.

Login via Console

media-1230596722517.png

On the console of the server, press ALT and F2 buttons to show a login prompt. Log in as root.

Make a Backup of SSH Config File

media-1230596846078.png

First we’ll save a copy of the /etc/ssh/sshd_config file as /etc/ssh/sshd_config.original in case we need a backup. Type in the following:
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original

Open SSH Config File

media-1230597001567.png

Next we’ll edit /etc/ssh/sshd_config using a notepad-like program called Nano. Type in the following:
nano /etc/ssh/sshd_config
Find the line that says:
PermitRootLogin no

Edit SSH Config File

media-1230597079733.png

Change the line to read:
PermitRootLogin yes

Now save the file and exit by pressing CTRL and X.

Restart SSH Service

media-1230597174611.png

Next, restart the SSH daemon (service) by typing:
service sshd restart

Connecting through SSH via Putty

media-1230597466415.png

To connect via Secure Shell (SSH), you’ll need to use a SSH program, like Putty. Putty is widely known and used since it’s a free open source program. A copy of Putty can be downloaded off the internet by searching Google for “putty ssh download”. Putty is a standalone executable program which does not require installation. I usually copy it to My Documents or a network share and then place a Shortcut on my Desktop or Quick Launch bar. Once downloaded, go ahead and start Putty.
Then type in the IP address of the ESX server into the address location field as shown. You can also type in the IP address and give it a name under ‘Saved Sessions’ and then press “Save”. This will create a session you can easily load by selecting the name and pressing “Load”. This makes it easy so you don’t have to remember IP addresses of your different ESX servers.

Logon to ESX Server

media-1230597639815.png

Once you connect to the server, you’ll need to login as “root”. Type your password (it will not be displayed on the screen). When you login, it will show you the host where root last logged in from and then it will display a command prompt where you can issue commands.

Linux Physical to Virtual

January 30, 2009

While VMware provides great tools for managing the conversion of Windows based workloads from physical hardware to virtual machines, no tool is provided to aid in the conversion of Linux systems to virtual workloads.

This lesson will detail one method for completing this conversion. The procedure will vary slightly depending up on the distribution and version being converted.

This example was conducted using CentOS 4.7, RedHat Linux 4.x will be nearly identical; other distributions will vary.

Overview of Physical to Virtual (P2V) Process

The overall P2V process – the conversion of a Physical installed workload to a Virtual machine – has 3 distinct steps.
– Driver Injection
– Image Transfer
– Tools Installation

Depending on your distribution, the first two steps may be easier to perform in a specific order. In this example we will perform the steps in the order above.

Driver Injection

The most difficult (and critical) part of the P2V process is insuring that the migrated workload will actually boot, and have the needed drivers to access the virtual hardware once it has been transferred to the virtual machine.

The most difficult portion of this is making sure that we get the workload the ability to access the virtual machine’s hard disk, and thus the ability to boot.

We want to make the target (virtual) machine use a SCSI adapter, because while VMware’s hosted products support IDE disks, the ESX (and ESXi) products do not.

Under CentOS, (and RHEL) Linux, the drivers which are needed for hard disk access are provided as kernel modules. Getting the transferred machine to boot is simply a matter of getting the right modules loaded into the kernel. Now the question – what are the right modules? And how do we get them loaded?

First we need to understand that the boot loader will load the kernel, and it’s boot time configuration from the Init Ram Disk aka ‘initrd’ … so we need to get the modules and the config to load them into the initrd.

The inclusion of and loading of the relevant kernel modules is controlled by /etc/modeprobe.conf (or /etc/modules.conf on RHEL 3). This file needs to include lines to load the drivers for the SCSI adapter provided by the virtual environment.

On linux distributions using the 2.6.x kernels we want the LSI scsi drivers, on 2.4.x kernels we will want to use a buslogic adapter.

Make a backup, then edit the /etc/modules.conf file to include the lines highlighted.

media-1233269017751.png

Kernel Modules for LSI SCSI driver shown.

The initrd is generated using the mkinitrd script; again the examples shown are for CentOS 4.7, your distribution may vary.

To generate an initrd, use the following command:

mkinitrd <initrd-file> <kernel version>

This will generate a new initrd as shown.

Again, make a copy, or rename the old initrd so that you can fall back to it if you need to.

media-1233269275863.png

Once the initrd has been generated you’re ready to transfer the image to a virtual machine.

NOTE: If your source machine is using IDE disks and not using LVM ( so filesystems mounted as /dev/hda#) you will need to update your fstab. The same holds if your system is using disk-by-id or uuid based mountpoints. The simplest way of coping with the former is to convert /dev/hda# to /dev/sda#. With the latter conversion to /dev/sda# is probably the easiest.

ALSO NOTE: If for some reason your physical machine does not have a c compiler and the kernel headers on it. Now would be a good time to install those packages – if only temporarily; it will make installing VMware tools later a simpler proposition.

Image Transfer

Like most things, there is more than one way to skin this particular cat. What we’re after is to move the system ‘image’ from the source Physical machine to the target Virtual machine. You could use Ghost, Portlock Storage Manager, Altriris, DriveImage, or any number of commercial utilities. You could also use partimg or other open source utilities. You could even use tar or dump & restore if you’re so inclined. Use something you’re comfortable with.

An important note here is the issue of Logical Volume Managers – LVM – which abstract the filesystems from the physical disk structure. The challenge LVM introduces is that if you’re using a tool like Ghost which wants to image filesystems, few (if any) understand the LVM use of the disk. This means we either need to use an “above the filesystem” tool, such as Tar or Dump & Restore, or a tool which can perform sector/block level imaging. The downside of sector imaging is that the target hard disk needs to be the same size as the source hard disk. If your source Physical machine has a 300GB disk, your target VM will also have a 300GB disk. Dump and Restore, or even Tar will get you around this problem, but it will require you to spend more time installing boot loaders and the like.

For this example, we’ll use the old staple ‘dd’ and a linux live CD to facilitate the transfer. This sector-based technique will transfer the boot loader, partition table, and linux LVM partitions, so we don’t have to piece our image back together after the transfer.

Capture Source Image

Ok, yes you can get creative with SSH and avoid creating the intermediate image ‘file’ – but for simplicity sake (and to avoid the SSH encryption overhead and resultant performance hit) we’re going to create an image file with DD, and then restore it.

Step 1 – Boot the source system from the linux live CD.

Step 2 – Mount a file-space somewhere with enough free space to store the image. Remember this will be the same size as the source machine’s hard disk.
– for an NFS mount use: mount -t nfs file.server:/path/to/mount /mountpoint (example: mount -t nfs myserver.mydomain:/exports/scratchspace /mnt)
– for an Windows/SMB/CIFS mount the command takes a couple forms, depending on your distro. Choose the one that works.
mount -t cifs -o lfs,username=<userid> “//server.domain/share “/mountpoint (example: mount -t cifs -o lfs,username=kenf  “//mysever.mydomain/scratchspace” /mnt)
mount-t smbfs -o lfs,user=<userid> “//server.domain/share” /mountpoint (example: mount -t smbfs -o lfs,user=kenf “//myserver.mydomain/scratchspace” /mnt)

Step 3 – create the image with the ‘dd’ command. The format of the command is dd if=<source> of=<destination> bs=<bytes size of I/O>
– example: dd if=/dev/hda of=/mnt/image-file.dd /bs=65535

An example of the mount and image creation follows.

Note: if your live CD isn’t the same as your installed distro, the device mappings might not be the same – your installed distro might address your IDE disk as /dev/hda but the live CD might address it as /dev/sda. Check your device before imaging it to avoid unpleasant surprises.

media-1233270213567.png

Restore the image in the VM

Now that we have our image captured, we’re done with the source machine. if you’re not concerned about the data on the machine changing, we can reboot it normally and let it return to service.

At this point we want to restore the image we need to -
1.) Create a New virtual machine with appropriate memory, network interfaces, and critically a hard disk of exactly the same size as the source machine had.
2.) Boot the new virtual machine from our Linux Live CD.
3.) mount the file space in the same way we did earlier (NFS, CIFS, SMBFS…)
4.) Restore the image with the ‘dd’ command again. To do this we reverse the ‘if=’ and ‘of =’ parameters. Note that if your source was an ide disk (/dev/hd*) and our target is scsi (/dev/sd*) we need to make the appropriate adjustments. An example is shown.

media-1233270963080.png

Reboot the converted machine

Now that the image has been restored, we’re ready to reboot the machine. If all has gone well it will reboot and the machine will in fact boot the converted operating system.

This is a good place to note that some Linux distributions have other daemons and services which will modify and even overwrite the modules.conf or modeprobe.conf file we edited earlier. Redhat is one such distro. If you are working on one of these it’s important that you get the process which is managing the .conf file to recognize the new drivers – otherwise every time your initrd gets regenerated you’ll find a nice panic message after the reboot.

After the machine boots, we need to move on to installing VMware tools.

Install VMware Tools

What about the network adapter? I’m glad you asked…

Under VMware, the tools package provides a number of drivers and services to make virtual machines be better guest’s. One of the drivers provided by the tools is an enhanced network adapter. Therefore, it’s not really worth while to ‘solve’ the problem of the network adapter until we’re ready to install tools, and installing tools will resolve the network adapter problem for us.

That said there is another potential problem to be aware of – some distros lock their network config to the MAC address of the adapter. This process will assign a new MAC to the machine, so that the virtual machine’s MAC will not be the same as the physical machine’s. You may need to update the the network config of the converted machine to address this. In the case of RHEL and CentOS, edit the files under /etc/sysconfig/network-scripts/ifconfig-eth0 (and eth1, eth2.. etc if you have more than one NIC). You can either comment the line reading HWADDR= or update it with the new MAC address.

At this point we will install vmware tools per the ‘standard’ way of doing so. Right click the VM, select “install VMware tools” then mount the virtual CDrom device in the VM. Install tools per the usual method for the distribution you’re running. The RPM based install is shown.

media-1233271451061.png

Once the tools package is installed you will need to configure it, do so by running ‘vmware-configure-tools.pl’ and following the prompts. If you don’t have the c compiler and kernel headers installed on your machine it may be necessary to install them now to complete the tools configuration. The compiler and header files are used to build kernel modules for (among other things) the enhanced network driver.

The configuration of a basic CentOS tools install is shown.

media-1233271527689.png

answer the questions asked and complete the install process.

media-1233271607379.png

Notice the reference to needing to restart networking.. You can follow the instructions displayed or simply reboot the virtual machine at this point.

Conversion Complete

if all has gone well, your workload conversion is done, your machine is running in a virtual machine with it’s configuration and data intact.

Happy Virtualizing!