Introduction to Adding Physical Disks in VMware Virtual Machines
Introduction to Adding Physical Disks to VMware Virtual Machines
VMware virtual machines can add physical disks as virtual disks available for use within the VM. This process essentially virtualizes the physical disk, turning it into a hard drive inside the VMware virtual machine.
How to Add a Physical Disk to a Virtual Machine
First, adding a physical disk in VMware requires administrator privileges. Therefore, before launching VMware, right-click the VMware icon and select “Run as administrator.”
Alternatively, we can configure VMware to always run with administrator privileges.
- Right-click the VMware shortcut
- Click the “Compatibility” tab at the top
- Click “Change settings for all users”
- Check “Run this program as an administrator”
- Click “OK” through all dialogs
After running VMware as an administrator, open the virtual machine you want to configure, click “Edit virtual machine settings,” and then click “Add.”
- Select the first option, “Hard Disk”
- Proceed with the default settings until you see a screen with the option “Use a physical disk (advanced)”
- Select this physical disk option, then choose “PhysicalDrive X” from the dropdown list
How do you determine which number X corresponds to in PhysicalDrive X?
First, if your computer has only one disk, there will be only PhysicalDrive 0.
If there are two disks, there will also be a PhysicalDrive 1.
You can use the Disk Management tool to confirm.
- Right-click the Start menu and select “Disk Management (K)”
- In the list displayed by Disk Management, identify which disk is the one you want to attach to the virtual machine.
- Note the disk number, and select that corresponding number in VMware.
Which Disks Can We Select?
We cannot select the disk that contains the system drive.
When VMware attaches a disk, it needs to unmount that disk from the host system, making it inaccessible to the host. Therefore, if you select the disk containing the system drive, the host system cannot unmount it, preventing the virtual machine from starting.
However, if you choose to attach only a non-system partition on the disk containing the system drive, you can mount that partition normally.
In addition to internal computer disks, we can also attach external USB disks.
However, you may encounter issues when starting the virtual machine:
When starting the VM, you may see an error: “Cannot open the disk or one of its dependent snapshot disks. The disk module failed to start. The virtual machine failed to start.”
This is a very common error when attaching physical disks, typically occurring with external USB drives.
There are two solutions for the above error:
First method:
- Press Windows+R, type
cmd, and press Enter to open Command Prompt. - Type
diskpartand press Enter. - In diskpart, type
list disk. - From the list of disks, find the USB drive you want to attach (e.g., Disk 1).
- Type
select disk 1. - Type
offline disk.
Two outcomes may occur:
- “The physical disk is now offline”: Success. You can directly open the VMware virtual machine.
- “Cannot operate on removable media”: Failure. The USB drive cannot be taken offline.
If the second outcome occurs, you must use the following method:
- Completely close VMware, eject the USB drive, and unplug it.
- Plug the USB drive back in without doing anything else.
- Open VMware and start the virtual machine.
- Close the error message and start the virtual machine again.
- Repeat this process about 10 times, and the virtual machine should start successfully. After shutting down, it will start directly next time.
The above method was derived from my own experience. The cause is currently unknown; it may be a VMware bug. I found no related methods online, and apart from the diskpart offline method, almost all other solutions are ineffective.
When Do We Need to Attach a Physical Disk?
Generally, there is no need to attach physical disks in most scenarios.
If your goal is to transfer files between the host and the virtual machine, there is no need to use this method.
Methods for exchanging files between a virtual machine and a physical machine include:
- Installing VMware Tools, which allows bidirectional copy-paste between the VM and the host.
- Using an ISO disc image file: package the files to be transferred into an ISO file, add a virtual CD/DVD drive to the VM, and select this ISO file to simulate inserting a disc into the VM.
- Using a local network for file transfer: use LAN file transfer tools (e.g., IP Messenger) to transfer files between the two.
- Using specialized software: tools like 7-Zip, DiskGenius, or WinRAR can open VMware virtual disk files (*.vmdk) and extract files directly from the virtual disk to the physical machine.
In this case, file extraction can only be performed when the virtual machine is shut down—i.e., when the .vmdk virtual disk is not being read or written. Otherwise, the .vmdk file cannot be opened.
Back to the main topic: when do we need to attach a physical disk?
I believe this operation is only necessary when testing specific features of a physical disk.
A Few Real-World Examples I’ve Encountered:
Testing a Bootable USB Drive Created with Ventoy or Similar Tools
After creating a bootable USB drive using a tool like Ventoy, you can attach the USB drive to a virtual machine and boot the VM from it to verify whether the drive was created successfully.
Please note:
Even if it’s a USB drive, once attached to a virtual machine, it becomes a virtual hard disk. The VM treats this virtual hard disk as an internal drive installed inside the VM’s “chassis.”
Therefore, in the VM’s BIOS, this USB drive will appear under the “Hard Disk” (HDD or Hard Disk) category for boot devices, not under “Removable Boot Devices.”
So, do not attempt to boot the VM from removable storage devices.
Verifying Whether a System Migration Was Successful
When using tools like DiskGenius for disk cloning or system migration, we often clone the system from an internal disk to an external USB disk. In such cases, the system may fail to boot from the USB disk after migration.
This is likely because the boot disk is connected via USB to the motherboard, rather than being an internal drive connected via a PCIe interface. This is not due to a failed system clone or migration. It is a peculiar issue for which I have found no explanation online.
Therefore, to simulate the USB disk as if it were connected internally via PCIe, we can attach it to a virtual machine, effectively treating it as an internal disk.
By booting the system on this disk inside the VM, we can determine whether the system migration was successful.
If it still fails, consider repairing system boot issues or checking for corrupted system files.