Skip to content

标题: VMware用Host的U盘启动Guest

创建: 2019-04-15 14:17 更新: 2019-08-27 17:49 链接: https://scz.617.cn/windows/201904151417.txt


VMware Workstation可以直接把Host的物理硬盘或者其分区用作Guest的硬盘,也支 持把Host的U盘用作Guest的硬盘。不过对U盘的支持有以下注意事项:

a)

必须在启动VMware之前插入U盘,VMware的物理硬盘列表中才会出现之前插入的U盘, 形如"PhysicalDriveN"

b)

VMware主程序必须以管理员权限运行,才能成功创建Guest的硬盘,之后就不需要以 管理员权限运行VMware主程序了。

Host的U盘用作Guest的硬盘,最大的好处就是VMware可以用Host的U盘启动Guest。具 体操作是为Guest添加硬盘,选中Host的U盘。


这是小钻风在2011年时写的。过去我没这需求,一直没留心过,今天因故要用这招。

如果你不确定"PhysicalDriveN"中的"N",可以用diskmgmt.msc看,"磁盘3"对应 "PhysicalDrive3"。

Host是x64/Win7,VMware Workstation 15。Host的U盘是枚WinPE,MBR/PBR中用 BOOTICE写入"GRUB for DOS",FAT32文件系统。该U盘在老旧BIOS上成功启动WinPE, 现在想在VMware 15中启动WinPE。

最初没成功,提示:

"The physical disk is already in use"

在vmware.log中看到:

W32Util_DismountVolumes: Locking and dismounting volumes backed by a particular disk area (offset 0 size 15552479232) on PhysicalDrive2... W32Util_DismountVolumes: Successfully locked volume \?\Volume{b7943091-2ff4-11e9-8570-000000000a3a} on PhysicalDrive2. W32Util_DismountVolumes: Successfully dismounted volume \?\Volume{b7943091-2ff4-11e9-8570-000000000a3a} on PhysicalDrive2. W32Util_DismountVolumes: CreateFileW1 failed on volume \?\Volume{77e51b9a-39e7-11e7-9dbb-005056c00008}: 2 W32Util_CloseDismountHandle: Unlocking and closing handles for 1 volumes on PhysicalDrive2... W32Util_CloseDismountHandle: Successfully unlocked volume \?\Volume{b7943091-2ff4-11e9-8570-000000000a3a} on PhysicalDrive2. DISKLIB-FLAT : Open: Failed to dismount physical drive 2. Perhaps its volumes have open files on them? DISKLIB-FLAT : "\.\PhysicalDrive2" : failed to open (73): . DISKLIB-LINK : "X:\VM\WinPE\WinPE.vmdk" : failed to open (The physical disk is already in use). DISKLIB-CHAIN : "X:\VM\WinPE\WinPE.vmdk" : failed to open (The physical disk is already in use). DISKLIB-LIB : Failed to open 'X:\VM\WinPE\WinPE.vmdk' with flags 0xa The physical disk is already in use (73). DISK: Cannot open disk 'X:\VM\WinPE\WinPE.vmdk': The physical disk is already in use (73).

在Process Explorer中未发现用户态进程使用U盘。

搜了一下,好像与OS、VMware都有关,比如VMware 8会碰上,VMware 7不会碰上, 再比如说Win7容易碰上。

最后试了如下步骤:


a)

用diskmgmt.msc删除U盘盘符

"fsutil volume dismount x:"不适用于U盘,也不等价于"mountvol x:\ /D",天晓 得干啥了。

b)

$ diskpart

DISKPART> automount disable DISKPART> automount scrub DISKPART> exit

或许"mountvol /n"也可以,未测试。

c)

重启Host(x64/Win7)

这一步很重要,之前做了步骤b之后没有重启Host,结果死活不成功。只需要重启这 一次,以后不再需要重启。

d)

插入U盘

diskmgmt.msc中U盘没有盘符,"VMware USB Arbitration Service"服务启用中,与 该服务无关。如果其他时间想在Host中使用U盘,用diskmgmt.msc手工分配盘符即可。

e)

打开VMware 15,用U盘成功启动WinPE

在vmware.log中看到:

W32Util_DismountVolumes: Locking and dismounting volumes backed by a particular disk area (offset 0 size 7751073792) on PhysicalDrive2... W32Util_DismountVolumes: Successfully locked volume \?\Volume{ab1c3818-5e9d-11e9-b3ad-000000111111} on PhysicalDrive2. W32Util_DismountVolumes: Successfully dismounted volume \?\Volume{ab1c3818-5e9d-11e9-b3ad-000000111111} on PhysicalDrive2. AIOWIN32C: '\.\PhysicalDrive2' : Failed to issue ioctl 508040: The request is not supported (50). OBJLIB-FILEBE : FileBEIoctl: ioctl operation failed on '\.\PhysicalDrive2' : The request is not supported (3276802) HOSTDISK-WIN32: Facts: Cap=15138816 Phys C/H/S=942/255/63 BIOS C/H/S=942/255/63 Adap=SCSI DISKLIB-DSCPTR: Opened [0]: "\.\PhysicalDrive2" 0 partitionUUID \?\usbstor#disk&ven_kingston&prod_datatraveler_2.0&rev_pmap#6cf049e31fc2b0608993850a&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b} (0xa) DISKLIB-LINK : Opened 'X:\VM\WinPE\WinPE.vmdk' (0xa): fullDevice, 15138816 sectors / 7.2 GB. DISKLIB-LIB : Opened "X:\VM\WinPE\WinPE.vmdk" (flags 0xa, type fullDevice). DISKLIB-LIB_MISC : DiskLib_GetStorageBlockSizes: Failed to get storage block sizes, The virtual disk requires a feature not supported by this program. DISK: Disk 'X:\VM\WinPE\WinPE.vmdk' has UUID '60 00 c2 93 88 a6 7e 42-05 57 55 76 e6 d6 89 ff' DISK: OPEN 'X:\VM\WinPE\WinPE.vmdk' Geo (942/255/63) BIOS Geo (942/255/63)

本文所说的U盘就是普通U盘,没有动用量产工具模拟成光盘。如果你很顺利地在 VMware中用U盘成功启动Guest,就不必理会本文所述内容,如果你碰上 "The physical disk is already in use",可以参照前文尝试解决。