How to Convert a Physical Hard Drive to VMWare Virtual Machine (Windows Server 2003 Case Study)


2 views

html

When dealing with legacy systems like Windows Server 2003 running on failed hardware, converting the physical hard drive to a VMWare virtual machine becomes crucial for data recovery and continuity. While VMWare Converter is typically used for P2V conversions of live systems, we'll explore alternative methods for disk-to-VM conversion.

  • Original hard drive (IDE/SATA/SCSI)
  • Write blocker or read-only adapter (recommended)
  • Working system with VMWare Workstation/ESXi
  • Disk imaging tools (dd, WinHex, or FTK Imager)
  • Sufficient storage space for disk image

1. Create Disk Image

First, create a sector-by-sector copy of the original drive:

# Linux (dd command example)
sudo dd if=/dev/sdX of=server2003.img bs=1M conv=noerror,sync status=progress

# Windows (using PowerShell)
.\dd.exe if=\\.\PhysicalDriveX of=C:\backup\server2003.img --size 1M --noerror

2. Convert Raw Image to VMDK

Use VMWare's vmkfstools to convert the raw image:

vmkfstools -i server2003.img -d thin server2003.vmdk

Alternatively, use qemu-img for cross-platform conversion:

qemu-img convert -f raw -O vmdk server2003.img server2003.vmdk

3. Create New VM Configuration

For Windows Server 2003, create a new VM with compatible settings:

# Example VMX configuration
config.version = "8"
virtualHW.version = "4"
memsize = "2048"
displayName = "LegacyServer2003"
guestOS = "winnetenterprise"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsilogic"
scsi0:0.present = "TRUE"
scsi0:0.fileName = "server2003.vmdk"

Windows Server 2003 may require additional drivers for virtualization:

  1. Inject VMware Tools ISO into VM
  2. Boot in Safe Mode (F8 during startup)
  3. Install LSI Logic and VMXNET drivers manually

For newer systems, you can use VMWare Converter in standalone mode:

vmware-converter.exe --sourceType=disk --sourcePath=\\.\PhysicalDriveX 
--destinationType=vmx --destinationVmPath="D:\VMs\LegacyServer"
  • For MBR/GPT issues: Use gdisk or testdisk to repair partition tables
  • For boot problems: Rebuild BCD using Windows Server 2003 installation media
  • For performance: Convert to thin-provisioned disks after successful boot

Here's a PowerShell script to automate parts of the process:

# Requires VMware PowerCLI module
Import-Module VMware.PowerCLI

$sourceDrive = "\\.\PhysicalDrive2"
$outputPath = "C:\VMWare\LegacyServer"
$vmName = "SRV2003-Migrated"

# Create raw image
$ddParams = @{
    InputFile = $sourceDrive
    OutputFile = "$outputPath\disk.img"
    BlockSize = 1MB
}
Start-Process -FilePath "dd.exe" -ArgumentList $ddParams -Wait

# Convert to VMDK
Invoke-Expression "qemu-img convert -f raw -O vmdk $outputPath\disk.img $outputPath\disk.vmdk"

# Create new VM
New-VM -Name $vmName -MemoryGB 2 -DiskPath "$outputPath\disk.vmdk" -GuestId "winnetenterprise"

When dealing with legacy systems, you might encounter a scenario where you need to virtualize a physical hard drive from a dead server. The original OS in this case is Windows Server 2003, which adds some complexity due to its age and potential driver compatibility issues with modern virtualization platforms.

VMware Converter typically requires a running system to perform physical-to-virtual (P2V) conversions. When working with just a hard drive, you'll need alternative approaches:

# This is the fundamental limitation:
VMware Converter requires:
1. Running source machine
2. Network connectivity
3. Administrator privileges

Microsoft's Disk2vhd utility is often the most reliable method for this conversion:

  1. Connect the physical drive to a working Windows machine (via USB enclosure or direct SATA connection)
  2. Download Disk2vhd from Microsoft's Sysinternals suite
  3. Run the tool with appropriate parameters:
Disk2vhd.exe \\?\PhysicalDrive1 C:\output\server2003.vhdx -accepteula

Once you have the VHDX file, you'll need to convert it to VMware's VMDK format:

# Using qemu-img (cross-platform solution):
qemu-img convert -p -O vmdk server2003.vhdx server2003.vmdk

# Alternative using VMware's vCenter Converter Standalone:
"C:\Program Files\VMware\VMware vCenter Converter Standalone\vmware-vdiskmanager.exe" -r server2003.vhdx -t 0 server2003.vmdk

After creating the VMDK, you might need to:

  • Create a new VM in VMware Workstation/ESXi with compatible hardware version
  • Adjust disk controller settings (IDE often works better for Windows Server 2003)
  • Install VMware Tools for optimal performance

For advanced users, you can directly map the physical disk to a VMware VM:

# VMware Workstation .vmx file addition:
scsi0:1.present = "TRUE"
scsi0:1.fileName = "physicalDrive1"
scsi0:1.deviceType = "physicalDisk"

This method requires careful handling as it gives the VM direct access to the physical hardware.

Common problems and solutions:

# For "INACCESSIBLE_BOOT_DEVICE" errors:
1. Check disk controller type in VM settings
2. Try both IDE and SCSI controllers
3. Use Windows Server 2003 recovery console to:
   - Run chkdsk /r
   - Run fixmbr and fixboot