Windows
將 Windows 路徑映射到 VirtualBox 的 Linux 路徑
我正在嘗試在 Linux + Windows 之間同步我的 VirtualBox 機器。但是,下面的配置文件以 Windows 目錄格式顯示。我的 Linux 位置是
/media/large/VirtualBox
,我的 Windows 是D:\VirtualBox
。有沒有辦法映射D:\
到/media/large
?編輯:我還需要自動更改
\
為/
.<?xml version="1.0" encoding="UTF-8"?> <!-- ** DO NOT EDIT THIS FILE. ** If you make changes to this file while any VirtualBox related application ** is running, your changes will be overwritten later, without taking effect. ** Use VBoxManage or the VirtualBox Manager GUI to make changes. --> <VirtualBox xmlns="http://www.virtualbox.org/" version="1.12-windows"> <Global> <ExtraData> <ExtraDataItem name="GUI/DetailsPageBoxes" value="general,system,preview,display,storage,audio,network,usb,sharedFolders,description"/> <ExtraDataItem name="GUI/GroupDefinitions/" value="go=Linux,go=Mac OSX,go=Virus Tests,go=Windows"/> <ExtraDataItem name="GUI/GroupDefinitions/Linux" value="m=961169b7-5d37-4b29-b4bf-c16c39ddda6a,m=321fafcc-9a84-4303-a8f6-777a54bbb420,m=41d67265-baf7-4b07-a98f-163012e4c1ef,m=48f12f20-604b-4977-b415-ca6ca4680c0f,m=e6b39bc1-0de8-49df-8cd1-92250840617e,m=0b09bc8a-8aa9-41e0-b79a-faef029003b0,m=9c6fc622-b0c1-47c8-b2b6-3a0a723257bd"/> <ExtraDataItem name="GUI/GroupDefinitions/Mac OSX" value="m=9136bf28-622b-4d5c-9dac-5c46529aff7b"/> <ExtraDataItem name="GUI/GroupDefinitions/Virus Tests" value="m=be4f52c0-4d86-445d-bf49-65d86bd1c8de"/> <ExtraDataItem name="GUI/GroupDefinitions/Windows" value="m=7ec90f6d-3bf2-4d96-912c-67283315a62b,m=d89443fc-2e4b-4870-a0d4-bf99b2d2a1f5,m=20a56fc1-4acf-436a-a3b1-6c79d1786911,m=4eecddd5-53d6-403f-9e11-3f91be2ea0f7"/> <ExtraDataItem name="GUI/HideDescriptionForWizards" value="NewVM"/> <ExtraDataItem name="GUI/HostScreenSaverDisabled" value="false"/> <ExtraDataItem name="GUI/Input/AutoCapture" value="true"/> <ExtraDataItem name="GUI/Input/HostKeyCombination" value="163"/> <ExtraDataItem name="GUI/LastItemSelected" value="m=Mac OSX 10.12 Sierra"/> <ExtraDataItem name="GUI/LastWindowPosition" value="0,23,1920,1027,max"/> <ExtraDataItem name="GUI/RecentFolderCD" value="D:/OS"/> <ExtraDataItem name="GUI/RecentFolderHD" value="D:/Virtual Box"/> <ExtraDataItem name="GUI/RecentListCD" value="D:\OS\Fedora-Workstation-Live-x86_64-25-1.3.iso,D:\OS\Windows 10 x64 Insider Preview.iso"/> <ExtraDataItem name="GUI/RecentListHD" value="D:\Virtual Box\UbuntuPartition.vmdk,D:\Virtual Box\UbuntuPartition-pt.vmdk,D:\Virtual Box\USB.vmdk,D:\Virtual Box\Windows\Windows 7\Windows 7.vdi,D:\Virtual Box\Windows 7.vdi"/> <ExtraDataItem name="GUI/SplitterSizes" value="638,1277"/> <ExtraDataItem name="GUI/SuppressMessages" value="remindAboutAutoCapture,remindAboutMouseIntegration"/> <ExtraDataItem name="GUI/UpdateCheckCount" value="8"/> <ExtraDataItem name="GUI/UpdateDate" value="never"/> </ExtraData> <MachineRegistry> <MachineEntry uuid="{961169b7-5d37-4b29-b4bf-c16c39ddda6a}" src="D:/Virtual Box/Linux/Debian/Debian.vbox"/> <MachineEntry uuid="{321fafcc-9a84-4303-a8f6-777a54bbb420}" src="D:/Virtual Box/Linux/Kali Linux/Kali Linux.vbox"/> <MachineEntry uuid="{41d67265-baf7-4b07-a98f-163012e4c1ef}" src="D:/Virtual Box/Linux/Linux Mint Mate/Linux Mint Mate.vbox"/> <MachineEntry uuid="{48f12f20-604b-4977-b415-ca6ca4680c0f}" src="D:/Virtual Box/Linux/Ubuntu 16.04/Ubuntu 16.04.vbox"/> <MachineEntry uuid="{9136bf28-622b-4d5c-9dac-5c46529aff7b}" src="D:/Virtual Box/Mac OSX/Mac OSX 10.12 Sierra/Mac OSX 10.12 Sierra.vbox"/> <MachineEntry uuid="{be4f52c0-4d86-445d-bf49-65d86bd1c8de}" src="D:/Virtual Box/Virus Tests/Windows XP - Infected/Windows XP - Infected.vbox"/> <MachineEntry uuid="{20a56fc1-4acf-436a-a3b1-6c79d1786911}" src="D:/Virtual Box/Windows/Windows 8/Windows 8.vbox"/> <MachineEntry uuid="{4eecddd5-53d6-403f-9e11-3f91be2ea0f7}" src="D:/Virtual Box/Windows/Windows 10 Insider Preview/Windows 10 Insider Preview.vbox"/> <MachineEntry uuid="{7ec90f6d-3bf2-4d96-912c-67283315a62b}" src="D:/Virtual Box/Windows/Windows XP/Windows XP.vbox"/> <MachineEntry uuid="{d89443fc-2e4b-4870-a0d4-bf99b2d2a1f5}" src="D:\Virtual Box\Windows\Windows 7\Windows 7.vbox"/> <MachineEntry uuid="{e6b39bc1-0de8-49df-8cd1-92250840617e}" src="D:\Virtual Box/Linux\Fedora\Fedora.vbox"/> <MachineEntry uuid="{0b09bc8a-8aa9-41e0-b79a-faef029003b0}" src="D:\Virtual Box/Linux\Gparted\Gparted.vbox"/> <MachineEntry uuid="{9c6fc622-b0c1-47c8-b2b6-3a0a723257bd}" src="D:\Virtual Box/Linux\Ubuntu Partition\Ubuntu Partition.vbox"/> </MachineRegistry> <NetserviceRegistry> <DHCPServers> <DHCPServer networkName="HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter" IPAddress="192.168.56.100" networkMask="255.255.255.0" lowerIP="192.168.56.101" upperIP="192.168.56.254" enabled="1"/> </DHCPServers> </NetserviceRegistry> <SystemProperties defaultMachineFolder="D:\Virtual Box" defaultHardDiskFormat="VDI" VRDEAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3" exclusiveHwVirt="false"/> <USBDeviceFilters/> </Global> </VirtualBox>
如果您想避免擁有兩個 VirtualBox 配置文件但共享同一個配置文件,則需要考慮兩組轉換。
\
您在文件夾之間有帶有反斜杠的 Windows 路徑。例如,D:\OS\Fedora-Workstation-Live-x86_64-25-1.3.iso
/
您在文件夾之間有帶有正斜杠的 Windows 路徑。例如,D:/Virtual Box/Linux/Kali Linux/Kali Linux.vbox
在這兩種情況下,路徑都以
D:
您可以使用戰略性地放置在執行 VirtualBox 的目錄中的符號連結來修復路徑起點。此外,可以使用可重複的轉換來修復配置文件中的反斜杠:
ln -s /media/large 'D:' cp -p vbox.xml vbox.xml.old && tr '\\' / <vbox.xml.old >vbox.xml
如果您想避免修復 VirtualBox 配置文件本身,它會變得有點困難,但這並非不可能。理想情況下,您將返回並檢查 Windows 端是否可以提供正斜杠路徑。如果沒有,仔細應用符號連結可能會有所幫助。這是您必須應用的那種事情的範例:
ln -s 'D:'/OS/Fedora-Workstation-Live-x86_64-25-1.3.iso 'D:\OS\Fedora-Workstation-Live-x86_64-25-1.3.iso'
請注意,我已經引用了目標連結名稱並逐字保留了反斜杠。這將創建一個名稱,表面上可能看起來像是一個 Windows 文件名路徑,顯然包括文件夾,但實際上只是一個包含必要反斜杠的 UNIX 文件名。