Exporting EC2 Windows Root Volume as VMDK and Booting in VMware
Exporting EC2 Windows Root Volume as VMDK and Booting in VMware
EC2 instances launched from public Windows AMIs cannot be directly exported as VMDK via VM Import/Export because they contain AWS-licensed software. The workaround is to perform a block-level read of the EBS root volume after stopping the instance, convert it with qemu-img, and offline-enable Windows generic storage drivers to avoid blue screens in VMware.
Why VM Export Fails
Running create-instance-export-task may produce:
An error occurred (NotExportable) when calling the CreateInstanceExportTask operation:
The image ID (ami-xxxxxxxx) provided contains AWS-licensed software and is not exportable.This is a product limitation, not an IAM permissions issue. Windows / SQL Server / Marketplace images launched from public AWS AMIs are generally non-exportable.
Alternatives
Available options:
- If you can log in to the instance: use Disk2vhd.
- If you don't want to spin up a rescue instance: use coldsnap + qemu-img.
- If the instance can be stopped or has crashed: use a rescue instance for block-level EBS reading, then qemu-img conversion.
This article documents the third approach.
Key Pitfall: Storage Controller Drivers
EC2 Windows typically runs on NVMe devices. After exporting to VMware, the controller may change to LSI Logic SAS, SATA, or IDE. If these drivers are not set to Boot start in the Windows registry, you'll get a blue screen at boot:
UNMOUNTABLE_BOOT_VOLUMESo before conversion, you need to offline-modify the SYSTEM hive and set the Start value of common storage drivers to 0.
Procedure
1. Stop Instance and Detach Volume
aws ec2 stop-instances --instance-ids <instance-id>
aws ec2 wait instance-stopped --instance-ids <instance-id>
aws ec2 detach-volume --volume-id <volume-id>
aws ec2 wait volume-available --volume-ids <volume-id>
aws ec2 attach-volume \
--volume-id <volume-id> \
--instance-id <helper-instance-id> \
--device /dev/sdgIt's recommended to create a snapshot of the volume before proceeding.
2. Identify Disk on Rescue Instance
sudo lsblk -o NAME,SIZE,SERIAL,MOUNTPOINT,FSTYPEOn Nitro instances, EBS appears as /dev/nvmeXn1. You can match volume IDs via the SERIAL field.
3. Mount Working Disk
sudo mkfs.xfs -f /dev/nvme1n1
sudo mkdir -p /mnt/work
sudo mount /dev/nvme1n1 /mnt/workThe working disk must be larger than the actual output size of the target volume.
4. Install Tools
sudo dnf install -y qemu-img gcc make perlIf hivex is not available in the repository, you'll need to install it from source. It's used to edit Windows registry hives.
5. Mount NTFS and Backup SYSTEM Hive
sudo modprobe ntfs3
sudo mkdir -p /mnt/windows
sudo mount -t ntfs3 -o rw /dev/nvme2n1p1 /mnt/windows
sudo cp /mnt/windows/Windows/System32/config/SYSTEM /mnt/work/SYSTEM_BACKUP
sudo cp /mnt/windows/Windows/System32/config/SYSTEM /tmp/SYSTEM_EDIT6. Enable Generic Storage Drivers
The following services need their Start set to 0:
| Service | Purpose |
|---|---|
storahci | SATA AHCI |
intelide | IDE |
pciide | PCI IDE |
LSI_SAS | Common VMware SCSI |
iaStorV | Intel Storage Virtualization |
stornvme | Keep EC2 NVMe bootable |
If using a Windows machine to edit:
reg load HKLM\OFFLINE C:\Temp\SYSTEM
reg add "HKLM\OFFLINE\ControlSet001\Services\LSI_SAS" /v Start /t REG_DWORD /d 0 /f
reg add "HKLM\OFFLINE\ControlSet001\Services\storahci" /v Start /t REG_DWORD /d 0 /f
reg add "HKLM\OFFLINE\ControlSet001\Services\stornvme" /v Start /t REG_DWORD /d 0 /f
reg unload HKLM\OFFLINEOn Linux, you can use hivex to accomplish the same operation.
After writing back, unmount:
sudo cp /tmp/SYSTEM_EDIT /mnt/windows/Windows/System32/config/SYSTEM
sudo sync
sudo umount /mnt/windows7. Convert to VMDK
You must input the entire disk, not just a partition:
sudo qemu-img convert -p \
-f raw -O vmdk \
-o subformat=monolithicSparse \
/dev/nvme2n1 /mnt/work/instance-fixed.vmdkmonolithicSparse is suitable for local use with VMware Workstation.
8. Create Virtual Machine in VMware
Key configuration:
| Setting | Recommended Value |
|---|---|
| Firmware | BIOS (MBR partition table) |
| I/O Controller | LSI Logic SAS |
| Disk Type | SCSI |
| Disk | Use existing VMDK |
The first boot may install drivers and require a restart — this is normal.
Common Issues
| Issue | Cause | Solution |
|---|---|---|
| UNMOUNTABLE_BOOT_VOLUME | Storage drivers not enabled | Offline modify SYSTEM hive |
| Boot enters UEFI loop | MBR disk with UEFI selected | Switch to BIOS |
| VMDK unusable | Only converted a partition | Re-convert the entire disk |
| Windows not activated | AWS KMS doesn't apply locally | Ignore for testing or use your own license |
Summary
There are three key points for exporting an EC2 Windows root volume to VMware:
- VM Export has restrictions on AWS-licensed Windows images — direct export is not possible.
- Use a rescue instance for block-level EBS reading, then convert with
qemu-imgto VMDK. - Offline-enable VMware-compatible storage drivers before conversion, otherwise you'll get a blue screen.
This approach is suitable for downtime migration, offline forensics, and local verification of failed instances.
