Oracle VM VirtualBox技巧

配置文件

Linux 虛擬機配置文件分爲兩處。html

windows下:
一、用戶名/.VirtualBox/
這裏面有2個配置文件:
VirtualBox.xml 和 VirtualBox.xml-prev. 後面一個是備份文件, 能夠不用管他, 前面一個咱們能夠看看裏面的內容:web

<?xml version="1.0"?>
<!--
** 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.innotek.de/VirtualBox-settings" 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="m=83d5321d-32f6-438b-b81c-3e336ccc1460,m=ef9627ae-2637-4f90-a9e9-1423fbdccbd1"/>
      <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=xp"/>
      <ExtraDataItem name="GUI/LastWindowPosition" value="298,89,770,550"/>
      <ExtraDataItem name="GUI/SplitterSizes" value="192,573"/>
      <ExtraDataItem name="GUI/SuppressMessages" value="confirmInputCapture"/>
    </ExtraData>
    <MachineRegistry>
      <MachineEntry uuid="{ef9627ae-2637-4f90-a9e9-1423fbdccbd1}" src="D:\VirtualBox VMs\xp\xp.vbox"/>
      <MachineEntry uuid="{55a1a18a-0cb6-4238-bcdb-2df5d647e255}" src="D:\VirtualBox VMs\centos\centos.vbox"/>
    </MachineRegistry>
    <MediaRegistry>
      <HardDisks/>
      <DVDImages/>
      <FloppyImages/>
    </MediaRegistry>
    <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:\VirtualBox VMs" defaultHardDiskFormat="VDI" VRDEAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3" exclusiveHwVirt="false"/>
    <USBDeviceFilters/>
  </Global>
</VirtualBox>

注意此處定義虛擬機文件uuid及所在位置:segmentfault

<MachineRegistry>
  <MachineEntry uuid="{ef9627ae-2637-4f90-a9e9-1423fbdccbd1}" src="D:\VirtualBox VMs\xp\xp.vbox"/>
  <MachineEntry uuid="{55a1a18a-0cb6-4238-bcdb-2df5d647e255}" src="D:\VirtualBox VMs\centos\centos.vbox"/>
</MachineRegistry>

其中uuid來自於src對應文件.vbox裏面的:windows

<Machine uuid="{55a1a18a-0cb6-4238-bcdb-2df5d647e255}" name="centos" OSType="RedHat" snapshotFolder="Snapshots" lastStateChange="2015-12-02T14:16:08Z">

若是不當心從新從新安裝VirtualBox或者刪除了VirtualBox的配置文件,只要虛擬機沒有刪除(如.vbox、.vdi文件),能夠從新安裝虛擬機後仿照MachineRegistry裏MachineEntry添加一行。注意uuid不錯,必須和.vbox裏的一致。centos

二、虛擬機目錄裏的.vbox文件
這是個文本文件,能夠直接編輯。例如:app

<?xml version="1.0"?>
<!--
** 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.innotek.de/VirtualBox-settings" version="1.15-windows">
  <Machine uuid="{55a1a18a-0cb6-4238-bcdb-2df5d647e255}" name="centos" OSType="RedHat" snapshotFolder="Snapshots" lastStateChange="2015-12-02T14:16:08Z">
    <MediaRegistry>
      <HardDisks>
        <HardDisk uuid="{e1e7ffe5-9b7c-4c94-932f-72b4810a274f}" location="centos-disk2_1.vmdk" format="VMDK" type="Normal"/>
        <HardDisk uuid="{b914d8b0-b772-427b-a840-cadc1cf0391a}" location="data.vdi" format="VDI" type="Normal"/>
      </HardDisks>
      <DVDImages/>
      <FloppyImages/>
    </MediaRegistry>
    <ExtraData>
      <ExtraDataItem name="GUI/LastCloseAction" value="PowerOff"/>
      <ExtraDataItem name="GUI/LastGuestSizeHint" value="720,400"/>
      <ExtraDataItem name="GUI/LastNormalWindowPosition" value="8,30,720,445"/>
      <ExtraDataItem name="GUI/RestrictedRuntimeDevicesMenuActions" value="HardDrives"/>
      <ExtraDataItem name="GUI/RestrictedRuntimeMachineMenuActions" value="SaveState,PowerOff"/>
      <ExtraDataItem name="GUI/StatusBar/IndicatorOrder" value="HardDisks,OpticalDisks,FloppyDisks,Network,USB,SharedFolders,Display,VideoCapture,Features,Mouse,Keyboard"/>
    </ExtraData>
    <Hardware version="2">
      <CPU count="1" hotplug="false">
        <HardwareVirtEx enabled="true"/>
        <HardwareVirtExNestedPaging enabled="true"/>
        <HardwareVirtExVPID enabled="true"/>
        <HardwareVirtExUX enabled="true"/>
        <PAE enabled="true"/>
        <HardwareVirtExLargePages enabled="true"/>
        <HardwareVirtForce enabled="false"/>
      </CPU>
      <Memory RAMSize="512" PageFusion="false"/>
      <HID Pointing="PS2Mouse" Keyboard="PS2Keyboard"/>
      <HPET enabled="false"/>
      <Chipset type="PIIX3"/>
      <Boot>
        <Order position="1" device="HardDisk"/>
        <Order position="2" device="DVD"/>
        <Order position="3" device="None"/>
        <Order position="4" device="None"/>
      </Boot>
      <Display VRAMSize="12" monitorCount="1" accelerate3D="false" accelerate2DVideo="false"/>
      <VideoCapture enabled="false" screens="18446744073709551615" horzRes="1024" vertRes="768" rate="512" fps="25" maxTime="0" maxSize="0"/>
      <RemoteDisplay enabled="false" authType="Null" authTimeout="5000"/>
      <BIOS>
        <ACPI enabled="true"/>
        <IOAPIC enabled="false"/>
        <Logo fadeIn="true" fadeOut="true" displayTime="0"/>
        <BootMenu mode="MessageAndMenu"/>
        <TimeOffset value="0"/>
        <PXEDebug enabled="false"/>
      </BIOS>
      <USB>
        <Controllers>
          <Controller name="OHCI" type="OHCI"/>
          <Controller name="EHCI" type="EHCI"/>
        </Controllers>
        <DeviceFilters/>
      </USB>
      <Network>
        <Adapter slot="0" enabled="true" MACAddress="080027F9C460" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <InternalNetwork name="intnet"/>
            <NATNetwork name="NatNetwork"/>
          </DisabledModes>
          <NAT>
            <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
            <Alias logging="false" proxy-only="false" use-same-ports="false"/>
          </NAT>
        </Adapter>
        <Adapter slot="1" enabled="true" MACAddress="080027597536" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
            <InternalNetwork name="intnet"/>
            <NATNetwork name="NatNetwork"/>
          </DisabledModes>
          <BridgedInterface name="Microsoft Loopback Adapter"/>
        </Adapter>
        <Adapter slot="2" enabled="true" MACAddress="080027E33818" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
            <InternalNetwork name="intnet"/>
            <NATNetwork name="NatNetwork"/>
          </DisabledModes>
          <BridgedInterface name="Broadcom 802.11n &#x7F51;&#x7EDC;&#x9002;&#x914D;&#x5668;"/>
        </Adapter>
        <Adapter slot="3" enabled="false" MACAddress="08002724B024" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
          </DisabledModes>
        </Adapter>
        <Adapter slot="4" enabled="false" MACAddress="0800275ACDE2" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
          </DisabledModes>
        </Adapter>
        <Adapter slot="5" enabled="false" MACAddress="080027715437" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
          </DisabledModes>
        </Adapter>
        <Adapter slot="6" enabled="false" MACAddress="08002733EDEE" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
          </DisabledModes>
        </Adapter>
        <Adapter slot="7" enabled="false" MACAddress="080027B318D4" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
          </DisabledModes>
        </Adapter>
      </Network>
      <UART>
        <Port slot="0" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/>
        <Port slot="1" enabled="false" IOBase="0x2f8" IRQ="3" hostMode="Disconnected"/>
      </UART>
      <LPT>
        <Port slot="0" enabled="false" IOBase="0x378" IRQ="7"/>
        <Port slot="1" enabled="false" IOBase="0x378" IRQ="7"/>
      </LPT>
      <AudioAdapter controller="AC97" driver="DirectSound" enabled="true"/>
      <RTC localOrUTC="UTC"/>
      <SharedFolders/>
      <Clipboard mode="Disabled"/>
      <DragAndDrop mode="Disabled"/>
      <IO>
        <IoCache enabled="true" size="5"/>
        <BandwidthGroups/>
      </IO>
      <HostPci>
        <Devices/>
      </HostPci>
      <EmulatedUSB>
        <CardReader enabled="false"/>
      </EmulatedUSB>
      <Guest memoryBalloonSize="0"/>
      <GuestProperties>
        <GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="zh_CN" timestamp="1449065768536626000" flags=""/>
      </GuestProperties>
    </Hardware>
    <StorageControllers>
      <StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
        <AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
      </StorageController>
      <StorageController name="SATA" type="AHCI" PortCount="2" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
        <AttachedDevice type="HardDisk" hotpluggable="true" port="0" device="0">
          <Image uuid="{e1e7ffe5-9b7c-4c94-932f-72b4810a274f}"/>
        </AttachedDevice>
        <AttachedDevice type="HardDisk" hotpluggable="false" port="1" device="0">
          <Image uuid="{b914d8b0-b772-427b-a840-cadc1cf0391a}"/>
        </AttachedDevice>
      </StorageController>
    </StorageControllers>
  </Machine>
</VirtualBox>

以直接修改這個文件, 可是文件註釋告訴咱們不要手動修改. 因此仍是老老實實用程序或者經過界面修改吧。dom

CentOS 6.6 Minimal設置文件夾共享

安裝加強功能

須要先更新內核ide

yum clean all
yum install kernel-devel
yum install kernel-headers
yum install gcc
yum install make  
reboot

而後安裝加強功能:oop

mount -t auto /dev/cdrom /mnt
cd /mnt
sh ./VBoxLinuxAdditions.run

配置共享文件夾

打開 VirtualBox 界面,選擇對應的虛擬系統進行"設置",選中設置窗口中的最後一項"共享文件夾",再選中"固定分配",右鍵單擊並肯定共享文件夾的路徑,下面的複選框一個都不用勾選,最後"肯定"。ui

啓動虛擬系統,進入系統之後,執行如下命令來掛載共享文件夾:mount -t vboxsf shared /mnt,其中 shared 爲共享文件夾的名字,/mnt 表示當前掛載到 mnt 目錄下。若是須要取消掛載,能夠直接使用命令:umount -f /mnt

設置開機自動掛載:上述掛載方法只能起到臨時掛載的效果,沒法作到每次開機自動掛載,若是想要實現自動掛載,能夠在開機時執行掛載腳本:vi /etc/rc.d/rc.local,在文件的最後面加上掛載命令:mount -t vboxsf shared /mnt,這樣就能夠實現每次開機時自動掛載共享文件夾了。

參考

一、CentOS 6.6 Minimal設置VirtualBox的共享文件夾 - 互聯網小青年 - SegmentFault http://www.javashuo.com/article/p-hpjmoaix-kp.html
二、VirtualBox--CentOS6.4設置文件夾共享 - 簡書 http://www.jianshu.com/p/34e42a7e2235
三、VirtualBox安裝Centos後實現文件夾共享 - VincentFu - 博客園 http://www.cnblogs.com/vincentfu/p/6893925.html
四、/sbin/mount.vboxsf: mounting failed with the error: No such device - daiyudong2020的博客 - CSDN博客 http://blog.csdn.net/daiyudong2020/article/details/58073520

相關文章
相關標籤/搜索