參考: Windows下VirtualBox直接使用物理硬盤作虛擬機磁盤 https://www.mobibrw.com/2015/2441
https://forums.virtualbox.org/viewtopic.php?f=6&t=86736
1.把硬盤設置爲脫機(必須先做這一步, 再生成vmdk文件)
2.創建vmdk文件
任務欄的左下角(微軟圖標)單擊右鍵-->命令提示符(管理員)(A)-->執行命令
有3個參數, 要根據自身情況調整
C:\Program Files\Oracle\VirtualBox\VBoxManage.exe 虛擬機程序的安裝位置
I:\VirtualBox VMs\win10.vmdk vmdk文件的存放位置
PhysicalDrive1 代表磁盤 1 (磁盤從 0開始算起, 仔細看上圖)
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands createrawvmdk -filename "I:\VirtualBox VMs\win10.vmdk" -rawdisk \\.\PhysicalDrive1
成功會提示:
RAW host disk access VMDK file I:\VirtualBox VMs\win10.vmdk created successfully.
如果沒有使用管理員權限 則會報錯
VBoxManage.exe: error: Cannot open the raw disk '\\.\PhysicalDrive1': VERR_ACCESS_DENIED
VBoxManage.exe: error: The raw disk vmdk file was not created
3.給VirtualBox.exe設置爲管理員身份啓動
4.把win10.vmdk添加到虛擬介質管理中
5.創建虛擬機(略)
6.添加到虛擬機中
最後啓動虛擬機即可
============================
報錯提示
The I/O cache encountered an error while updating data in medium "ahci-0-0" (rc=VERR_ACCESS_DENIED). Make sure there is enough free space on the disk and that the disk is working properly. Operation can be resumed afterwards
必須得 先生成的vmdk文件, 再進行硬盤脫機, 不然就會報這個錯
在VirtualBox虛擬機中,VDI、VMDK、VHD或HDD,應該使用那個磁盤映像? https://vimsky.com/article/3578.html
vdi: 是 virtualBox 獨有的格式
vmdk : 是虛擬機的通用的格式