FreeBSD Bugzilla – Attachment 159023 Details for
Bug 201578
Update bhyve chapter with note on CPU UG feature & zfs vol examples
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Final reviewed patch (D3105)
rev6.diff (text/plain), 64.40 KB, created by
Shawn Debnath
on 2015-07-20 19:40:20 UTC
(
hide
)
Description:
Final reviewed patch (D3105)
Filename:
MIME Type:
Creator:
Shawn Debnath
Created:
2015-07-20 19:40:20 UTC
Size:
64.40 KB
patch
obsolete
>Index: en_US.ISO8859-1/books/handbook/virtualization/chapter.xml >=================================================================== >--- en_US.ISO8859-1/books/handbook/virtualization/chapter.xml (revision 46986) >+++ en_US.ISO8859-1/books/handbook/virtualization/chapter.xml (working copy) >@@ -1,1606 +1,1631 @@ > <?xml version="1.0" encoding="iso-8859-1"?> > <!-- > The FreeBSD Documentation Project > > $FreeBSD$ > --> > <chapter xmlns="http://docbook.org/ns/docbook" > xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" > xml:id="virtualization"> > > <info> > <title>Virtualization</title> > > <authorgroup> > <author> > <personname> > <firstname>Murray</firstname> > <surname>Stokely</surname> > </personname> > <contrib>Contributed by </contrib> > </author> > </authorgroup> > > <authorgroup> > <author> > <personname> > <firstname>Allan</firstname> > <surname>Jude</surname> > </personname> > <contrib>bhyve section by </contrib> > </author> > </authorgroup> > </info> > > <sect1 xml:id="virtualization-synopsis"> > <title>Synopsis</title> > > <para>Virtualization software allows multiple operating systems to > run simultaneously on the same computer. Such software systems > for PCs often involve a host operating system which runs the > virtualization software and supports any number of guest > operating systems.</para> > > <para>After reading this chapter, you will know:</para> > > <itemizedlist> > <listitem> > <para>The difference between a host operating system and a > guest operating system.</para> > </listitem> > > <listitem> > <para>How to install &os; on an &intel;-based &apple; > &mac; computer.</para> > </listitem> > > <!-- > Note: There is no working/end-user ready Xen support for FreeBSD as of 07-2010. > Hide all information regarding Xen under FreeBSD. > > <listitem> > <para>How to install &os; on Linux with > <application>&xen;</application>.</para> > </listitem> > --> > <listitem> > <para>How to install &os; on µsoft.windows; with > <application>Virtual PC</application>.</para> > </listitem> > > <listitem> > <para>How to install &os; as a guest in > <application>bhyve</application>.</para> > </listitem> > > <listitem> > <para>How to tune a &os; system for best performance under > virtualization.</para> > </listitem> > > </itemizedlist> > > <para>Before reading this chapter, you should:</para> > > <itemizedlist> > <listitem> > <para>Understand the <link linkend="basics">basics of &unix; > and &os;</link>.</para> > </listitem> > > <listitem> > <para>Know how to <link linkend="install">install > &os;</link>.</para> > </listitem> > > <listitem> > <para>Know how to <link linkend="advanced-networking">set up a > network connection</link>.</para> > </listitem> > > <listitem> > <para>Know how to <link linkend="ports">install additional > third-party software</link>.</para> > </listitem> > </itemizedlist> > </sect1> > > <sect1 xml:id="virtualization-guest"> > <title>&os; as a Guest OS</title> > > <sect2 xml:id="virtualization-guest-parallels"> > <title><application>Parallels</application> on &macos; X</title> > > <para><application>Parallels Desktop</application> for &mac; is > a commercial software product available for &intel; based > &apple; &mac; computers running &macos; 10.4.6 or higher. > &os; is a fully supported guest operating system. Once > <application>Parallels</application> has been installed on > &macos; X, the user must configure a virtual machine and then > install the desired guest operating system.</para> > > <sect3 xml:id="virtualization-guest-parallels-install"> > <title>Installing &os; on Parallels/&macos; X</title> > > <para>The first step in installing &os; on > <application>Parallels</application> is to create a new > virtual machine for installing &os;. Select > <guimenuitem>&os;</guimenuitem> as the <guimenu>Guest OS > Type</guimenu> when prompted:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd1"/> > </imageobject> > </mediaobject> > > <para>Choose a reasonable amount of disk and memory > depending on the plans for this virtual &os; instance. > 4GB of disk space and 512MB of RAM work well for most uses > of &os; under <application>Parallels</application>:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd2"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd3"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd4"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd5"/> > </imageobject> > </mediaobject> > > <para>Select the type of networking and a network > interface:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd6"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd7"/> > </imageobject> > </mediaobject> > > <para>Save and finish the configuration:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd8"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd9"/> > </imageobject> > </mediaobject> > > <para>After the &os; virtual machine has been created, &os; > can be installed on it. This is best done with an > official &os; CD/DVD or with an ISO image downloaded from an > official FTP site. Copy the appropriate ISO image to the > local &mac; filesystem or insert a CD/DVD in the &mac;'s CD > drive. Click on the disc icon in the bottom right corner of > the &os; <application>Parallels</application> window. This > will bring up a window that can be used to associate the > CDROM drive in the virtual machine with the ISO file on disk > or with the real CDROM drive.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd11"/> > </imageobject> > </mediaobject> > > <para>Once this association with the CDROM source has been > made, reboot the &os; virtual machine by clicking the reboot > icon. <application>Parallels</application> will reboot with > a special BIOS that first checks if there is a CDROM.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd10"/> > </imageobject> > </mediaobject> > > <para>In this case it will find the &os; installation media > and begin a normal &os; installation. Perform the > installation, but do not attempt to configure > <application>&xorg;</application> at this time.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd12"/> > </imageobject> > </mediaobject> > > <para>When the installation is finished, reboot into the > newly installed &os; virtual machine.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/parallels-freebsd13"/> > </imageobject> > </mediaobject> > </sect3> > > <sect3 xml:id="virtualization-guest-parallels-configure"> > <title>Configuring &os; on > <application>Parallels</application> </title> > > <para>After &os; has been successfully installed on &macos; > X with <application>Parallels</application>, there are a > number of configuration steps that can be taken to > optimize the system for virtualized operation.</para> > > <procedure> > <step> > <title>Set Boot Loader Variables</title> > > <para>The most important step is to reduce the > <option>kern.hz</option> tunable to reduce the CPU > utilization of &os; under the <application>Parallels > </application> environment. This is accomplished by > adding the following line to <filename> > /boot/loader.conf</filename>:</para> > > <programlisting>kern.hz=100</programlisting> > > <para>Without this setting, an idle &os; > <application>Parallels</application> guest will use > roughly 15% of the CPU of a single processor &imac;. > After this change the usage will be closer to 5%.</para> > </step> > > <step> > <title>Create a New Kernel Configuration File</title> > > <para>All of the SCSI, FireWire, and USB device drivers > can be removed from a custom kernel configuration file. > <application>Parallels</application> provides a virtual > network adapter used by the &man.ed.4; driver, so all > network devices except for &man.ed.4; and &man.miibus.4; > can be removed from the kernel.</para> > </step> > > <step> > <title>Configure Networking</title> > > <para>The most basic networking setup uses DHCP to connect > the virtual machine to the same local area network as > the host &mac;. This can be accomplished by adding > <literal>ifconfig_ed0="DHCP"</literal> to > <filename>/etc/rc.conf</filename>. More advanced > networking setups are described in > <xref linkend="advanced-networking"/>.</para> > </step> > </procedure> > </sect3> > </sect2> > > <!-- > Deactivate/hide this section as the instructions in there do NOT work any more: > - FreeBSD 7.0 has reached its EOL a long time ago. > - The needed files from www.fsmware.com are not available any more, as the > server is dead. So it is impossible to follow the instructions in here. > > jkois@FreeBSD.org, 2010-06-18 > > <sect2 id="virtualization-guest-xen"> > <sect2info> > <authorgroup> > <author> > <firstname>Fukang</firstname> > <surname>Chen (Loader)</surname> > <contrib>Contributed by </contrib> > </author> > </authorgroup> > </sect2info> > > <title>&os; with &xen; on Linux</title> > > <para>The <application>&xen;</application> hypervisor is an > open source paravirtualization product which is now > supported by the commercial XenSource company. Guest > operating systems are known as domU domains, and the host > operating system is known as dom0. The first step in > running a virtual &os; instance under Linux is to install > <application>&xen;</application> for Linux dom0. The host > operating system will be a Slackware Linux > distribution.</para> > > <sect3 id="xen-slackware-dom0"> > <title>Setup &xen; 3 on Linux dom0</title> > > <procedure> > <step> > <title>Download &xen; 3.0 from XenSource</title> > > <para>Download <ulink > url="http://bits.xensource.com/oss-xen/release/3.0.4-1/src.tgz/xen-3.0.4_1-src.tgz">xen-3.0.4_1-src.tgz</ulink> > from <ulink > url="http://www.xensource.com/"></ulink>.</para> > </step> > > <step> > <title>Unpack the tarball</title> > > <screen>&prompt.root; <userinput>cd xen-3.0.4_1-src</userinput> > &prompt.root; <userinput>KERNELS="linux-2.6-xen0 linux-2.6-xenU" make world</userinput> > &prompt.root; <userinput>make install</userinput></screen> > > <note> > <para>To re-compile the kernel for dom0:</para> > > <screen>&prompt.root; <userinput>cd xen-3.0.4_1-src/linux-2.6.16.33-xen0</userinput> > &prompt.root; <userinput>make menuconfig</userinput> > &prompt.root; <userinput>make</userinput> > &prompt.root; <userinput>make install</userinput></screen> > > <para>Older version of > <application>&xen;</application> may need to specify > <command>make ARCH=xen menuconfig</command></para> > </note> > </step> > > <step> > <title>Add a Menu Entry into Grub > <filename>menu.lst</filename></title> > > <para>Edit <filename>/boot/grub/menu.lst</filename> and > add the following lines:</para> > > <programlisting>title Xen-3.0.4 > root (hd0,0) > kernel /boot/xen-3.0.4-1.gz dom0_mem=262144 > module /boot/vmlinuz-2.6.16.33-xen0 root=/dev/hda1 ro</programlisting> > </step> > > <step> > <title>Reboot Your Computer into &xen;</title> > > <para>First, edit > <filename>/etc/xen/xend-config.sxp</filename>, and add > the following line:</para> > > <programlisting>(network-script 'network-bridge netdev=eth0')</programlisting> > > <para>Then, we can launch > <application>&xen;</application>:</para> > > <screen>&prompt.root; <userinput>/etc/init.d/xend start</userinput> > &prompt.root; <userinput>/etc/init.d/xendomains start</userinput></screen> > > <para>Our dom0 is running:</para> > > <screen>&prompt.root; <userinput>xm list</userinput> > Name ID Mem VCPUs State Time(s) > Domain-0 0 256 1 r––––– 54452.9</screen> > </step> > </procedure> > </sect3> > > <sect3> > <title>&os; 7-CURRENT <emphasis>domU</emphasis></title> > > <para>Download the &os; domU kernel for > <application>&xen; 3.0</application> and disk image from > <ulink > url="http://www.fsmware.com/">http://www.fsmware.com/</ulink></para> > > <itemizedlist> > <listitem> > <para><ulink > url="http://www.fsmware.com/xenofreebsd/7.0/download/kernel-current">kernel-current</ulink></para> > </listitem> > > <listitem> > <para><ulink > url="http://www.fsmware.com/xenofreebsd/7.0/download/mdroot-7.0.bz2">mdroot-7.0.bz2</ulink></para> > </listitem> > > <listitem> > <para><ulink > url="http://www.fsmware.com/xenofreebsd/7.0/download/config/xmexample1.bsd">xmexample1.bsd</ulink></para> > </listitem> > </itemizedlist> > > <para>Put the configuration file > <filename>xmexample1.bsd</filename> into > <filename>/etc/xen/</filename> and modify the related > entries about where the kernel and the disk image are > stored. It should look like the following:</para> > > <programlisting>kernel = "/opt/kernel-current" > memory = 256 > name = "freebsd" > vif = [ '' ] > disk = [ 'file:/opt/mdroot-7.0,hda1,w' ] > #on_crash = 'preserve' > extra = "boot_verbose" > extra += ",boot_single" > extra += ",kern.hz=100" > extra += ",vfs.root.mountfrom=ufs:/dev/xbd769a"</programlisting> > > <para>Uncompress <filename>mdroot-7.0.bz2</filename>.</para> > > <para>Next, the __xen_guest section in > <filename>kernel-current</filename> needs to be altered to > add the VIRT_BASE that > <application>&xen; 3.0.3</application> requires:</para> > > <screen>&prompt.root; <userinput>objcopy kernel-current -R __xen_guest</userinput> > &prompt.root; <userinput>perl -e 'print "LOADER=generic,GUEST_OS=freebsd,GUEST_VER=7.0,XEN_VER=xen-3.0,BSD_SYMTAB,VIRT_BASE=0xC0000000\x00"' > tmp</userinput> > &prompt.root; <userinput>objcopy kernel-current ––add-section __xen_guest=tmp</userinput></screen> > > <screen>&prompt.root; <userinput>objdump -j __xen_guest -s kernel-current</userinput> > > kernel-current: file format elf32-i386 > > Contents of section __xen_guest: > 0000 4c4f4144 45523d67 656e6572 69632c47 LOADER=generic,G > 0010 55455354 5f4f533d 66726565 6273642c UEST_OS=freebsd, > 0020 47554553 545f5645 523d372e 302c5845 GUEST_VER=7.0,XE > 0030 4e5f5645 523d7865 6e2d332e 302c4253 N_VER=xen-3.0,BS > 0040 445f5359 4d544142 2c564952 545f4241 D_SYMTAB,VIRT_BA > 0050 53453d30 78433030 30303030 3000 SE=0xC0000000. </screen> > > <para>We are, now, ready to create and launch our > domU:</para> > > <screen>&prompt.root; <userinput>xm create /etc/xen/xmexample1.bsd -c</userinput> > Using config file "/etc/xen/xmexample1.bsd". > Started domain freebsd > WARNING: loader(8) metadata is missing! > Copyright (c) 1992-2006 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 > The Regents of the University of California. All rights reserved. > FreeBSD 7.0-CURRENT #113: Wed Jan 4 06:25:43 UTC 2006 > kmacy@freebsd7.gateway.2wire.net:/usr/home/kmacy/p4/freebsd7_xen3/src/sys/i386-xen/compile/XENCONF > WARNING: DIAGNOSTIC option enabled, expect reduced performance. > Xen reported: 1796.927 MHz processor. > Timecounter "ixen" frequency 1796927000 Hz quality 0 > CPU: Intel(R) Pentium(R) 4 CPU 1.80GHz (1796.93-MHz 686-class CPU) > Origin = "GenuineIntel" Id = 0xf29 Stepping = 9 > Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH, > DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> > Features2=0x4400<CNTX-ID,<b14>> > real memory = 265244672 (252 MB) > avail memory = 255963136 (244 MB) > xc0: <Xen Console> on motherboard > cpu0 on motherboard > Timecounters tick every 10.000 msec > [XEN] Initialising virtual ethernet driver. > xn0: Ethernet address: 00:16:3e:6b:de:3a > [XEN] > Trying to mount root from ufs:/dev/xbd769a > WARNING: / was not properly dismounted > Loading configuration files. > No suitable dump device was found. > Entropy harvesting: interrupts ethernet point_to_point kickstart. > Starting file system checks: > /dev/xbd769a: 18859 files, 140370 used, 113473 free (10769 frags, 12838 blocks, 4.2% fragmentation) > Setting hostname: demo.freebsd.org. > lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 > inet6 ::1 prefixlen 128 > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 > inet 127.0.0.1 netmask 0xff000000 > Additional routing options:. > Mounting NFS file systems:. > Starting syslogd. > /etc/rc: WARNING: Dump device does not exist. Savecore not run. > ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/X11R6/lib /usr/local/lib > a.out ldconfig path: /usr/lib/aout /usr/lib/compat/aout /usr/X11R6/lib/aout > Starting usbd. > usb: Kernel module not available: No such file or directory > Starting local daemons:. > Updating motd. > Starting sshd. > Initial i386 initialization:. > Additional ABI support: linux. > Starting cron. > Local package initialization:. > Additional TCP options:. > Starting background file system checks in 60 seconds. > > Sun Apr 1 02:11:43 UTC 2007 > > FreeBSD/i386 (demo.freebsd.org) (xc0) > > login: </screen> > > <para>The domU should run the &os; 7.0-CURRENT > kernel:</para> > > <screen>&prompt.root; <userinput>uname -a</userinput> > FreeBSD demo.freebsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #113: Wed Jan 4 06:25:43 UTC 2006 > kmacy@freebsd7.gateway.2wire.net:/usr/home/kmacy/p4/freebsd7_xen3/src/sys/i386-xen/compile/XENCONF i386</screen> > > <para>The network can now be configured on the domU. The > &os; domU will use a specific interface called > <devicename>xn0</devicename>:</para> > > <screen>&prompt.root; <userinput>ifconfig xn0 10.10.10.200 netmask 255.0.0.0</userinput> > &prompt.root; <userinput>ifconfig</userinput> > xn0: flags=843<UP,BROADCAST,RUNNING,SIMPLEX> mtu 1500 > inet 10.10.10.200 netmask 0xff000000 broadcast 10.255.255.255 > ether 00:16:3e:6b:de:3a > lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 > inet6 ::1 prefixlen 128 > inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 > inet 127.0.0.1 netmask 0xff000000 </screen> > > <para>On dom0 Slackware, some > <application>&xen;</application> dependent network > interfaces should show up:</para> > > <screen>&prompt.root; <userinput>ifconfig</userinput> > eth0 Link encap:Ethernet HWaddr 00:07:E9:A0:02:C2 > inet addr:10.10.10.130 Bcast:0.0.0.0 Mask:255.0.0.0 > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:815 errors:0 dropped:0 overruns:0 frame:0 > TX packets:1400 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:204857 (200.0 KiB) TX bytes:129915 (126.8 KiB) > > lo Link encap:Local Loopback > inet addr:127.0.0.1 Mask:255.0.0.0 > UP LOOPBACK RUNNING MTU:16436 Metric:1 > RX packets:99 errors:0 dropped:0 overruns:0 frame:0 > TX packets:99 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:9744 (9.5 KiB) TX bytes:9744 (9.5 KiB) > > peth0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF > UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 > RX packets:1853349 errors:0 dropped:0 overruns:0 frame:0 > TX packets:952923 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:1000 > RX bytes:2432115831 (2.2 GiB) TX bytes:86528526 (82.5 MiB) > Base address:0xc000 Memory:ef020000-ef040000 > > vif0.1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF > UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 > RX packets:1400 errors:0 dropped:0 overruns:0 frame:0 > TX packets:815 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:129915 (126.8 KiB) TX bytes:204857 (200.0 KiB) > > vif1.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF > UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 > RX packets:3 errors:0 dropped:0 overruns:0 frame:0 > TX packets:2 errors:0 dropped:157 overruns:0 carrier:0 > collisions:0 txqueuelen:1 > RX bytes:140 (140.0 b) TX bytes:158 (158.0 b) > > xenbr1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF > UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 > RX packets:4 errors:0 dropped:0 overruns:0 frame:0 > TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:0 > RX bytes:112 (112.0 b) TX bytes:0 (0.0 b)</screen> > > <screen>&prompt.root; <userinput>brctl show</userinput> > bridge name bridge id STP enabled interfaces > xenbr1 8000.feffffffffff no vif0.1 > peth0 > vif1.0</screen> > </sect3> > </sect2> > --> > <sect2 xml:id="virtualization-guest-virtualpc"> > <title><application>Virtual PC</application> on > &windows;</title> > > <para><application>Virtual PC</application> for &windows; is a > µsoft; software product available for free download. See > this website for the <link > xlink:href="http://www.microsoft.com/windows/downloads/virtualpc/sysreq.mspx">system > requirements</link>. Once <application>Virtual > PC</application> has been installed on µsoft.windows;, > the user can configure a virtual machine and then install the > desired guest operating system.</para> > > <sect3 xml:id="virtualization-guest-virtualpc-install"> > <title>Installing &os; on <application>Virtual > PC</application></title> > > <para>The first step in installing &os; on > <application>Virtual PC </application> is to create a new > virtual machine for installing &os;. Select > <guimenuitem>Create a virtual machine</guimenuitem> when > prompted:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd1"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd2"/> > </imageobject> > </mediaobject> > > <para>Select <guimenuitem>Other</guimenuitem> as the > <guimenuitem>Operating system</guimenuitem> when > prompted:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd3"/> > </imageobject> > </mediaobject> > > <para>Then, choose a reasonable amount of disk and memory > depending on the plans for this virtual &os; instance. > 4GB of disk space and 512MB of RAM work well for most uses > of &os; under <application>Virtual PC</application>:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd4"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd5"/> > </imageobject> > </mediaobject> > > <para>Save and finish the configuration:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd6"/> > </imageobject> > </mediaobject> > > <para>Select the &os; virtual machine and click > <guimenu>Settings</guimenu>, then set the type of networking > and a network interface:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd7"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd8"/> > </imageobject> > </mediaobject> > > <para>After the &os; virtual machine has been created, &os; > can be installed on it. This is best done with an > official &os; CD/DVD or with an ISO image downloaded from an > official FTP site. Copy the appropriate ISO image to the > local &windows; filesystem or insert a CD/DVD in the CD > drive, then double click on the &os; virtual machine to > boot. Then, click <guimenu>CD</guimenu> and choose > <guimenu>Capture ISO Image...</guimenu> on the > <application>Virtual PC</application> window. This will > bring up a window where the CDROM drive in the virtual > machine can be associated with an ISO file on disk or > with the real CDROM drive.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd9"/> > </imageobject> > </mediaobject> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd10"/> > </imageobject> > </mediaobject> > > <para>Once this association with the CDROM source has been > made, reboot the &os; virtual machine by clicking > <guimenu>Action</guimenu> and <guimenu>Reset</guimenu>. > <application>Virtual PC</application> will reboot with a > special BIOS that first checks for a CDROM.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd11"/> > </imageobject> > </mediaobject> > > <para>In this case it will find the &os; installation media > and begin a normal &os; installation. Continue with the > installation, but do not attempt to configure > <application>&xorg;</application> at this time.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd12"/> > </imageobject> > </mediaobject> > > <para>When the installation is finished, remember to eject > the CD/DVD or release the ISO image. Finally, reboot into > the newly installed &os; virtual machine.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/virtualpc-freebsd13"/> > </imageobject> > </mediaobject> > </sect3> > > <sect3 xml:id="virtualization-guest-virtualpc-configure"> > <title>Configuring &os; on <application>Virtual > PC</application></title> > > <para>After &os; has been successfully installed on > µsoft.windows; with <application>Virtual PC > </application>, there are a number of configuration > steps that can be taken to optimize the system for > virtualized operation.</para> > > <procedure> > <step> > <title>Set Boot Loader Variables</title> > > <para>The most important step is to reduce the > <option>kern.hz</option> tunable to reduce the CPU > utilization of &os; under the <application>Virtual > PC</application> environment. This is accomplished > by adding the following line to > <filename> /boot/loader.conf</filename>:</para> > > <programlisting>kern.hz=100</programlisting> > > <para>Without this setting, an idle &os; > <application>Virtual PC</application> guest OS will > use roughly 40% of the CPU of a single processor > computer. After this change, the usage will be > closer to 3%.</para> > </step> > > <step> > <title>Create a New Kernel Configuration File</title> > > <para>All of the SCSI, FireWire, and USB device drivers > can be removed from a custom kernel configuration file. > <application>Virtual PC</application> provides a virtual > network adapter used by the &man.de.4; driver, so all > network devices except for &man.de.4; and &man.miibus.4; > can be removed from the kernel.</para> > </step> > > <step> > <title>Configure Networking</title> > > <para>The most basic networking setup uses DHCP to connect > the virtual machine to the same local area network as > the µsoft.windows; host. This can be accomplished > by adding <literal>ifconfig_de0="DHCP"</literal> to > <filename>/etc/rc.conf</filename>. More advanced > networking setups are described in > <xref linkend="advanced-networking"/>.</para> > </step> > </procedure> > </sect3> > </sect2> > > <sect2 xml:id="virtualization-guest-vmware"> > <title><application>VMware Fusion</application> on > &macos;</title> > > <para><application>VMware Fusion</application> for &mac; is a > commercial software product available for &intel; based > &apple; &mac; computers running &macos; 10.4.9 or higher. > &os; is a fully supported guest operating system. Once > <application>VMware Fusion</application> has been > installed on &macos; X, the user can configure a virtual > machine and then install the desired guest operating > system.</para> > > <sect3 xml:id="virtualization-guest-vmware-install"> > <title>Installing &os; on <application>VMware > Fusion</application></title> > > <para>The first step is to start <application>VMware > Fusion</application> which will load the Virtual > Machine Library. Click <guimenuitem>New</guimenuitem> to > create the virtual machine:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd01"/> > </imageobject> > </mediaobject> > > <para>This will load the New Virtual Machine Assistant. Click > <guimenuitem>Continue</guimenuitem> to proceed:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd02"/> > </imageobject> > </mediaobject> > > <para>Select <guimenuitem>Other</guimenuitem> as the > <guimenuitem>Operating System</guimenuitem> and either > <guimenuitem>&os;</guimenuitem> or > <guimenuitem>&os; 64-bit</guimenuitem>, as the > <guimenu>Version</guimenu> when prompted:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd03"/> > </imageobject> > </mediaobject> > > <para>Choose the name of the virtual machine and the directory > where it should be saved:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd04"/> > </imageobject> > </mediaobject> > > <para>Choose the size of the Virtual Hard Disk for the virtual > machine:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd05"/> > </imageobject> > </mediaobject> > > <para>Choose the method to install the virtual machine, > either from an ISO image or from a CD/DVD:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd06"/> > </imageobject> > </mediaobject> > > <para>Click <guimenuitem>Finish</guimenuitem> and the virtual > machine will boot:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd07"/> > </imageobject> > </mediaobject> > > <para>Install &os; as usual:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd08"/> > </imageobject> > </mediaobject> > > <para>Once the install is complete, the settings > of the virtual machine can be modified, such as memory > usage:</para> > > <note> > <para>The System Hardware settings of the virtual machine > cannot be modified while the virtual machine is > running.</para> > </note> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd09"/> > </imageobject> > </mediaobject> > > <para>The number of CPUs the virtual machine will have access > to:</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd10"/> > </imageobject> > </mediaobject> > > <para>The status of the CDROM device. Normally the > CD/DVD/ISO is disconnected from the virtual machine when it > is no longer needed.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd11"/> > </imageobject> > </mediaobject> > > <para>The last thing to change is how the virtual machine will > connect to the network. To allow connections to the virtual > machine from other machines besides the host, choose > <guimenuitem>Connect directly to the physical network > (Bridged)</guimenuitem>. Otherwise, <guimenuitem>Share the > host's internet connection (NAT)</guimenuitem> is > preferred so that the virtual machine can have access to the > Internet, but the network cannot access the virtual > machine.</para> > > <mediaobject> > <imageobject> > <imagedata fileref="virtualization/vmware-freebsd12"/> > </imageobject> > </mediaobject> > > <para>After modifying the settings, boot the newly installed > &os; virtual machine.</para> > </sect3> > > <sect3 xml:id="virtualization-guest-vmware-configure"> > <title>Configuring &os; on <application>VMware > Fusion</application></title> > > <para>After &os; has been successfully installed on &macos; X > with <application>VMware Fusion</application>, there are a > number of configuration steps that can be taken to optimize > the system for virtualized operation.</para> > > <procedure> > <step> > <title>Set Boot Loader Variables</title> > > <para>The most important step is to reduce the > <option>kern.hz</option> tunable to reduce the CPU > utilization of &os; under the > <application>VMware Fusion</application> environment. > This is accomplished by adding the following line to > <filename>/boot/loader.conf</filename>:</para> > > <programlisting>kern.hz=100</programlisting> > > <para>Without this setting, an idle &os; > <application>VMware Fusion</application> guest will use > roughly 15% of the CPU of a single processor &imac;. > After this change, the usage will be closer to > 5%.</para> > </step> > > <step> > <title>Create a New Kernel Configuration File</title> > > <para>All of the FireWire, and USB device drivers can be > removed from a custom kernel configuration file. > <application>VMware Fusion</application> provides a > virtual network adapter used by the &man.em.4; driver, > so all network devices except for &man.em.4; can be > removed from the kernel.</para> > </step> > > <step> > <title>Configure Networking</title> > > <para>The most basic networking setup uses DHCP to connect > the virtual machine to the same local area network as > the host &mac;. This can be accomplished by adding > <literal>ifconfig_em0="DHCP"</literal> to > <filename>/etc/rc.conf</filename>. More advanced > networking setups are described in > <xref linkend="advanced-networking"/>.</para> > </step> > </procedure> > </sect3> > </sect2> > > <sect2 xml:id="virtualization-guest-virtualbox-guest-additions"> > <title>&virtualbox; Guest Additions on a &os; Guest</title> > > <para>The <application>&virtualbox;</application> guest > additions provide support for:</para> > > <itemizedlist> > <listitem> > <para>Clipboard sharing.</para> > </listitem> > > <listitem> > <para>Mouse pointer integration.</para> > </listitem> > > <listitem> > <para>Host time synchronization.</para> > </listitem> > > <listitem> > <para>Window scaling.</para> > </listitem> > > <listitem> > <para>Seamless mode.</para> > </listitem> > </itemizedlist> > > <note> > <para>The following commands are run in the &os; guest.</para> > </note> > > <para>First, install the > <package>emulators/virtualbox-ose-additions</package> package > or port in the &os; guest. This will install the port:</para> > > <screen>&prompt.root; <userinput>cd /usr/ports/emulators/virtualbox-ose-additions && make install clean</userinput></screen> > > <para>Add these lines to > <filename>/etc/rc.conf</filename>:</para> > > <programlisting>vboxguest_enable="YES" > vboxservice_enable="YES"</programlisting> > > <para>When <application>Xorg</application> will be used in the > guest, any required supporting services must also be enabled > just as if the guest was a physical machine. Typically, these > lines would also be added to > <filename>/etc/rc.conf</filename>:</para> > > <programlisting>hald_enable="YES" > dbus_enable="YES"</programlisting> > > <para>See <xref linkend="x-config"/> for details.</para> > > <para>If &man.ntpd.8; or &man.ntpdate.8; is used, disable host > time synchronization:</para> > > <programlisting>vboxservice_flags="--disable-timesync"</programlisting> > > <para><application>Xorg</application> will automatically > recognize the <literal>vboxvideo</literal> driver. > It can also be manually entered in > <filename>/etc/X11/xorg.conf</filename>:</para> > > <programlisting>Section "Device" > ### Available Driver options are:- > ### Values: <i>: integer, <f>: float, <bool>: "True"/"False", > ### <string>: "String", <freq>: "<f> Hz/kHz/MHz" > ### [arg]: arg optional > Identifier "Card0" > Driver "vboxvideo" > VendorName "InnoTek Systemberatung GmbH" > BoardName "VirtualBox Graphics Adapter" > BusID "PCI:0:2:0" > EndSection</programlisting> > > <para>To use the <literal>vboxmouse</literal> driver, adjust the > mouse section in > <filename>/etc/X11/xorg.conf</filename>:</para> > > <programlisting>Section "InputDevice" > Identifier "Mouse0" > Driver "vboxmouse" > EndSection</programlisting> > > <para><acronym>HAL</acronym> users should create the following > <filename>/usr/local/etc/hal/fdi/policy/90-vboxguest.fdi</filename> > or copy it from > <filename>/usr/local/share/hal/fdi/policy/10osvendor/90-vboxguest.fdi</filename>:</para> > > <programlisting><?xml version="1.0" encoding="utf-8"?> > <!-- > # Sun VirtualBox > # Hal driver description for the vboxmouse driver > # $Id: chapter.xml,v 1.33 2012-03-17 04:53:52 eadler Exp $ > > Copyright (C) 2008-2009 Sun Microsystems, Inc. > > This file is part of VirtualBox Open Source Edition (OSE, as > available from http://www.virtualbox.org. This file is free software; > you can redistribute it and/or modify it under the terms of the GNU > General Public License (GPL) as published by the Free Software > Foundation, in version 2 as it comes in the "COPYING" file of the > VirtualBox OSE distribution. VirtualBox OSE is distributed in the > hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. > > Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa > Clara, CA 95054 USA or visit http://www.sun.com if you need > additional information or have any questions. > --> > <deviceinfo version="0.2"> > <device> > <match key="info.subsystem" string="pci"> > <match key="info.product" string="VirtualBox guest Service"> > <append key="info.capabilities" type="strlist">input</append> > <append key="info.capabilities" type="strlist">input.mouse</append> > <merge key="input.x11_driver" type="string">vboxmouse</merge> > <merge key="input.device" type="string">/dev/vboxguest</merge> > </match> > </match> > </device> > </deviceinfo></programlisting> > </sect2> > </sect1> > > <sect1 xml:id="virtualization-host-virtualbox"> > <title>&os; as a Host with > <application>VirtualBox</application></title> > > <para><application>&virtualbox;</application> is an actively > developed, complete virtualization package, that is available > for most operating systems including &windows;, &macos;, &linux; > and &os;. It is equally capable of running &windows; or > &unix;-like guests. It is released as open source software, but > with closed-source components available in a separate extension > pack. These components include support for USB 2.0 devices. > More information may be found on the <link > xlink:href="http://www.virtualbox.org/wiki/Downloads"><quote>Downloads</quote> > page of the <application>&virtualbox;</application> > wiki</link>. Currently, these extensions are not available > for &os;.</para> > > <sect2 xml:id="virtualization-virtualbox-install"> > <title>Installing &virtualbox;</title> > > <para><application>&virtualbox;</application> is available as a > &os; package or port in > <package>emulators/virtualbox-ose</package>. The port can be > installed using these commands:</para> > > <screen>&prompt.root; <userinput>cd /usr/ports/emulators/virtualbox-ose</userinput> > &prompt.root; <userinput>make install clean</userinput></screen> > > <para>One useful option in the port's configuration menu is the > <literal>GuestAdditions</literal> suite of programs. These > provide a number of useful features in guest operating > systems, like mouse pointer integration (allowing the mouse to > be shared between host and guest without the need to press a > special keyboard shortcut to switch) and faster video > rendering, especially in &windows; guests. The guest > additions are available in the <guimenu>Devices</guimenu> > menu, after the installation of the guest is finished.</para> > > <para>A few configuration changes are needed before > <application>&virtualbox;</application> is started for the > first time. The port installs a kernel module in > <filename>/boot/modules</filename> which > must be loaded into the running kernel:</para> > > <screen>&prompt.root; <userinput>kldload vboxdrv</userinput></screen> > > <para>To ensure the module always gets loaded after a reboot, > add the following line to > <filename>/boot/loader.conf</filename>:</para> > > <programlisting>vboxdrv_load="YES"</programlisting> > > <para>To use the kernel modules that allow bridged or host-only > networking, add the following to > <filename>/etc/rc.conf</filename> and reboot the > computer:</para> > > <programlisting>vboxnet_enable="YES"</programlisting> > > <para>The <systemitem class="groupname">vboxusers</systemitem> > group is created during installation of > <application>&virtualbox;</application>. All users that need > access to <application>&virtualbox;</application> will have to > be added as members of this group. <command>pw</command> can > be used to add new members:</para> > > <screen>&prompt.root; <userinput>pw groupmod vboxusers -m <replaceable>yourusername</replaceable></userinput></screen> > > <para>The default permissions for > <filename>/dev/vboxnetctl</filename> are restrictive and need > to be changed for bridged networking:</para> > > <screen>&prompt.root; <userinput>chown root:vboxusers /dev/vboxnetctl</userinput> > &prompt.root; <userinput>chmod 0660 /dev/vboxnetctl</userinput></screen> > > <para>To make this permissions change permanent, add these > lines to <filename>/etc/devfs.conf</filename>:</para> > > <programlisting>own vboxnetctl root:vboxusers > perm vboxnetctl 0660</programlisting> > > <para>To launch <application>&virtualbox;</application>, > type from a <application>&xorg;</application> session:</para> > > <screen>&prompt.user; <userinput>VirtualBox</userinput></screen> > > <para>For more information on configuring and using > <application>&virtualbox;</application>, refer to the > <link xlink:href="http://www.virtualbox.org">official > website</link>. For &os;-specific information and > troubleshooting instructions, refer to the <link > xlink:href="http://wiki.FreeBSD.org/VirtualBox">relevant > page in the &os; wiki</link>.</para> > </sect2> > > <sect2 xml:id="virtualization-virtualbox-usb-support"> > <title>&virtualbox; USB Support</title> > > <para>In order to be able to read and write to USB devices, > users need to be members of > <systemitem class="groupname">operator</systemitem>:</para> > > <screen>&prompt.root; <userinput>pw groupmod operator -m <replaceable>jerry</replaceable></userinput></screen> > > <para>Then, add the following to > <filename>/etc/devfs.rules</filename>, or create this file if > it does not exist yet:</para> > > <programlisting>[system=10] > add path 'usb/*' mode 0660 group operator</programlisting> > > <para>To load these new rules, add the following to > <filename>/etc/rc.conf</filename>:</para> > > <programlisting>devfs_system_ruleset="system"</programlisting> > > <para>Then, restart devfs:</para> > > <screen>&prompt.root; <userinput>service devfs restart</userinput></screen> > > <para>USB can now be enabled in the guest operating system. USB > devices should be visible in the &virtualbox; > preferences.</para> > </sect2> > > <sect2 xml:id="virtualization-virtualbox-host-dvd-cd-access"> > <title>&virtualbox; Host DVD/CD Access</title> > > <para>Access to the host DVD/CD drives from guests is achieved > through the sharing of the physical drives. Within > &virtualbox;, this is set up from the Storage window in the > Settings of the virtual machine. If needed, create an empty > IDE CD/DVD device first. Then choose the Host Drive from the > popup menu for the virtual CD/DVD drive selection. A checkbox > labeled <literal>Passthrough</literal> will appear. This > allows the virtual machine to use the hardware directly. For > example, audio CDs or the burner will only function if this > option is selected.</para> > > <para><acronym>HAL</acronym> needs to run for > <application>&virtualbox;</application> DVD/CD functions to > work, so enable it in <filename>/etc/rc.conf</filename> and > start it if it is not already running:</para> > > <programlisting>hald_enable="YES"</programlisting> > > <screen>&prompt.root; <userinput>service hald start</userinput></screen> > > <para>In order for users to be able to use > <application>&virtualbox;</application> DVD/CD functions, they > need access to <filename>/dev/xpt0</filename>, > <filename>/dev/cd<replaceable>N</replaceable></filename>, and > <filename>/dev/pass<replaceable>N</replaceable></filename>. > This is usually achieved by making the user a member of > <systemitem class="groupname">operator</systemitem>. > Permissions to these devices have to be corrected by adding > these lines to <filename>/etc/devfs.conf</filename>:</para> > > <programlisting>perm cd* 0660 > perm xpt0 0660 > perm pass* 0660</programlisting> > > <screen>&prompt.root; <userinput>service devfs restart</userinput></screen> > </sect2> > </sect1> > > <sect1 xml:id="virtualization-host-bhyve"> > <title>&os; as a Host with > <application>bhyve</application></title> > > <para>Starting with &os; 10.0-RELEASE, the > <application>bhyve</application> <acronym>BSD</acronym>-licensed > hypervisor is part of the base system. This hypervisor supports > a number of guests, including &os;, OpenBSD, and many &linux; > distributions. Currently, <application>bhyve</application> only > supports a serial console and does not emulate a graphical > console. As a legacy-free hypervisor, it relies on the > virtualization offload features of newer > <acronym>CPU</acronym>s, instead of translating instructions and > manually managing memory mappings.</para> > > <para>Due to the design of <application>bhyve</application>, it > requires a computer with a newer processor that supports &intel; > Extended Page Tables (<acronym>EPT</acronym>) or &amd; Rapid > Virtualization Indexing (<acronym>RVI</acronym>), also known as >- Nested Page Tables (<acronym>NPT</acronym>). Most newer >- processors, specifically the &intel; &core; i3/i5/i7 and >- &intel; &xeon; E3/E5/E7, support this feature. For a >- complete list of &intel; processors that support >- <acronym>EPT</acronym>, refer to <link >- xlink:href="http://ark.intel.com/search/advanced?s=t&ExtendedPageTables=true">http://ark.intel.com/search/advanced?s=t&ExtendedPageTables=true</link>. >- <acronym>RVI</acronym> is found on the 3rd generation and later >- of the &amd.opteron; (Barcelona) processors. The easiest way to >- check for support of <acronym>EPT</acronym> or >- <acronym>RVI</acronym> is to look for the >- <literal>POPCNT</literal> processor feature flag on the >- <literal>Features2</literal> line in <command>dmesg</command> or >- <filename>/var/run/dmesg.boot</filename>.</para> >+ Nested Page Tables (<acronym>NPT</acronym>). In addition, to >+ host &linux; guests, or &os; guests with more than one >+ <acronym>vCPU</acronym>, <acronym>VMX</acronym> unrestricted >+ mode support (<acronym>UG</acronym>) is also required. Most >+ newer processors, specifically the &intel; &core; >+ i3/i5/i7 and &intel; &xeon; E3/E5/E7, support these >+ features. <acronym>UG</acronym> support was introduced with >+ Intel's Westmere micro-architecture. For a complete list of >+ &intel; processors that support <acronym>EPT</acronym>, refer >+ to <link xlink:href="http://ark.intel.com/search/advanced?s=t&ExtendedPageTables=true"/>. >+ <acronym>RVI</acronym> is found on the third generation and >+ later of the &amd.opteron; (Barcelona) processors. The easiest >+ way to tell if a processor will support >+ <application>bhyve</application> is to run >+ <command>dmesg</command> or look in >+ <filename>/var/run/dmesg.boot</filename> for >+ the <literal>POPCNT</literal> processor feature flag on the >+ <literal>Features2</literal> line and <literal>EPT</literal> and >+ <literal>UG</literal> on the <literal>VT-x</literal> line.</para> > > <sect2 xml:id="virtualization-bhyve-prep"> > <title>Preparing the Host</title> > > <para>The first step to creating a virtual machine in > <application>bhyve</application> is configuring the host > system. First, load the <application>bhyve</application> > kernel module:</para> > > <screen>&prompt.root; <userinput>kldload vmm</userinput></screen> > > <para>Then, create a <filename>tap</filename> interface for the > network device in the virtual machine to attach to. In order > for the network device to participate in the network, also > create a bridge interface containing the > <filename>tap</filename> interface and the physical interface > as members. In this example, the physical interface is > <replaceable>igb0</replaceable>:</para> > > <screen>&prompt.root; <userinput>ifconfig <replaceable>tap0</replaceable> create</userinput> > &prompt.root; <userinput>sysctl net.link.tap.up_on_open=1</userinput> > net.link.tap.up_on_open: 0 -> 1 > &prompt.root; <userinput>ifconfig <replaceable>bridge0</replaceable> create</userinput> > &prompt.root; <userinput>ifconfig <replaceable>bridge0</replaceable> addm <replaceable>igb0</replaceable> addm <replaceable>tap0</replaceable></userinput> > &prompt.root; <userinput>ifconfig <replaceable>bridge0</replaceable> up</userinput></screen> > </sect2> > > <sect2 xml:id="virtualization-bhyve-freebsd"> > <title>Creating a FreeBSD Guest</title> > > <para>Create a file to use as the virtual disk for the guest > machine. Specify the size and name of the virtual > disk:</para> > > <screen>&prompt.root; <userinput>truncate -s <replaceable>16G</replaceable> <replaceable>guest.img</replaceable></userinput></screen> > > <para>Download an installation image of &os; to install:</para> > > <screen>&prompt.root; <userinput>fetch <replaceable>ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/10.0/FreeBSD-10.0-RELEASE-amd64-bootonly.iso</replaceable></userinput> > FreeBSD-10.0-RELEASE-amd64-bootonly.iso 100% of 209 MB 570 kBps 06m17s</screen> > > <para>&os; comes with an example script for running a virtual > machine in <application>bhyve</application>. The script will > start the virtual machine and run it in a loop, so it will > automatically restart if it crashes. The script takes a > number of options to control the configuration of the machine: > <option>-c</option> controls the number of virtual CPUs, > <option>-m</option> limits the amount of memory available to > the guest, <option>-t</option> defines which > <filename>tap</filename> device to use, <option>-d</option> > indicates which disk image to use, <option>-i</option> tells > <application>bhyve</application> to boot from the > <acronym>CD</acronym> image instead of the disk, and > <option>-I</option> defines which <acronym>CD</acronym> image > to use. The last parameter is the name of the virtual > machine, used to track the running machines. This example > starts the virtual machine in installation mode:</para> > >- <screen>&prompt.root; <userinput>sh /usr/share/examples/bhyve/vmrun.sh -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> -t tap0 -d <replaceable>guest.img</replaceable> -i -I <replaceable>FreeBSD-10.0-RELEASE-amd64-bootonly.iso</replaceable> <replaceable>guestname</replaceable></userinput></screen> >+ <screen>&prompt.root; <userinput>sh /usr/share/examples/bhyve/vmrun.sh -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> -t <replaceable>tap0</replaceable> -d <replaceable>guest.img</replaceable> -i -I <replaceable>FreeBSD-10.0-RELEASE-amd64-bootonly.iso</replaceable> <replaceable>guestname</replaceable></userinput></screen> > > <para>The virtual machine will boot and start the installer. > After installing a system in the virtual machine, when the > system asks about dropping in to a shell at the end of the > installation, choose <guibutton>Yes</guibutton>. A small > change needs to be made to make the system start with a serial > console. Edit <filename>/etc/ttys</filename> and replace the > existing <literal>ttyu0</literal> line with:</para> > > <programlisting>ttyu0 "/usr/libexec/getty 3wire" xterm on secure</programlisting> > > <note><para>Beginning with &os; 9.3-RELEASE and > 10.1-RELEASE the console is configured > automatically.</para></note> > > <para>Reboot the virtual machine. While rebooting the virtual > machine causes <application>bhyve</application> to exit, the > <filename>vmrun.sh</filename> script runs > <command>bhyve</command> in a loop and will automatically > restart it. When this happens, choose the reboot option from > the boot loader menu in order to escape the loop. Now the > guest can be started from the virtual disk:</para> > >- <screen>&prompt.root; <userinput>sh /usr/share/examples/bhyve/vmrun.sh -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> -t tap0 -d <replaceable>guest.img</replaceable> <replaceable>guestname</replaceable></userinput></screen> >+ <screen>&prompt.root; <userinput>sh /usr/share/examples/bhyve/vmrun.sh -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> -t <replaceable>tap0</replaceable> -d <replaceable>guest.img</replaceable> <replaceable>guestname</replaceable></userinput></screen> > </sect2> > > <sect2 xml:id="virtualization-bhyve-linux"> > <title>Creating a &linux; Guest</title> > > <para>In order to boot operating systems other than &os;, the > <package>sysutils/grub2-bhyve</package> port must be first > installed.</para> > > <para>Next, create a file to use as the virtual disk for the > guest machine:</para> > > <screen>&prompt.root; <userinput>truncate -s <replaceable>16G</replaceable> <replaceable>linux.img</replaceable></userinput></screen> > > <para>Starting a virtual machine with > <application>bhyve</application> is a two step process. First > a kernel must be loaded, then the guest can be started. The > &linux; kernel is loaded with > <package>sysutils/grub2-bhyve</package>. Create a > <filename>device.map</filename> that > <application>grub</application> will use to map the virtual > devices to the files on the host system:</para> > > <programlisting>(hd0) ./linux.img > (cd0) ./somelinux.iso</programlisting> > > <para>Use <package>sysutils/grub2-bhyve</package> to load the > &linux; kernel from the <acronym>ISO</acronym> image:</para> > > <screen>&prompt.root; <userinput>grub-bhyve -m device.map -r cd0 -M <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen> > > <para>This will start grub. If the installation > <acronym>CD</acronym> contains a > <filename>grub.cfg</filename>, a menu will be displayed. > If not, the <literal>vmlinuz</literal> and > <literal>initrd</literal> files must be located and loaded > manually:</para> > > <screen>grub> <userinput>ls</userinput> > (hd0) (cd0) (cd0,msdos1) (host) > grub> <userinput>ls (cd0)/isolinux</userinput> > boot.cat boot.msg grub.conf initrd.img isolinux.bin isolinux.cfg memtest > splash.jpg TRANS.TBL vesamenu.c32 vmlinuz > grub> <userinput>linux (cd0)/isolinux/vmlinuz</userinput> > grub> <userinput>initrd (cd0)/isolinux/initrd.img</userinput> > grub> <userinput>boot</userinput></screen> > > <para>Now that the &linux; kernel is loaded, the guest can be > started:</para> > >- <screen>&prompt.root; <userinput>bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap1 -s 3:0,virtio-blk,./linux.img \ >--s 4:0,ahci-cd,./somelinux.iso -l com1,stdio -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen> >+ <screen>&prompt.root; <userinput>bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,<replaceable>tap1</replaceable> -s 3:0,virtio-blk,<replaceable>./linux.img</replaceable> \ >+ -s 4:0,ahci-cd,<replaceable>./somelinux.iso</replaceable> -l com1,stdio -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen> > > <para>The system will boot and start the installer. After > installing a system in the virtual machine, reboot the virtual > machine. This will cause <application>bhyve</application> to > exit. The instance of the virtual machine needs to be > destroyed before it can be started again:</para> > > <screen>&prompt.root; <userinput>bhyvectl --destroy --vm=<replaceable>linuxguest</replaceable></userinput></screen> > > <para>Now the guest can be started directly from the virtual > disk. Load the kernel:</para> > > <screen>&prompt.root; <userinput>grub-bhyve -m device.map -r hd0,msdos1 -M <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput> > grub> <userinput>ls</userinput> > (hd0) (hd0,msdos2) (hd0,msdos1) (cd0) (cd0,msdos1) (host) > (lvm/VolGroup-lv_swap) (lvm/VolGroup-lv_root) > grub> <userinput>ls (hd0,msdos1)/</userinput> > lost+found/ grub/ efi/ System.map-2.6.32-431.el6.x86_64 config-2.6.32-431.el6.x > 86_64 symvers-2.6.32-431.el6.x86_64.gz vmlinuz-2.6.32-431.el6.x86_64 > initramfs-2.6.32-431.el6.x86_64.img > grub> <userinput>linux (hd0,msdos1)/vmlinuz-2.6.32-431.el6.x86_64 root=/dev/mapper/VolGroup-lv_root</userinput> > grub> <userinput>initrd (hd0,msdos1)/initramfs-2.6.32-431.el6.x86_64.img</userinput> > grub> <userinput>boot</userinput></screen> > > <para>Boot the virtual machine:</para> > >- <screen>&prompt.root; <userinput>bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap1 \ >--s 3:0,virtio-blk,./linux.img -l com1,stdio -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen> >+ <screen>&prompt.root; <userinput>bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,<replaceable>tap1</replaceable> \ >+ -s 3:0,virtio-blk,<replaceable>./linux.img</replaceable> -l com1,stdio -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen> > > <para>&linux; will now boot in the virtual machine and > eventually present you with the login prompt. Login and use > the virtual machine. When you are finished, reboot the > virtual machine to exit <application>bhyve</application>. > Destroy the virtual machine instance:</para> > > <screen>&prompt.root; <userinput>bhyvectl --destroy --vm=<replaceable>linuxguest</replaceable></userinput></screen> > </sect2> > >+ <sect2 xml:id="virtualization-bhyve-zfs"> >+ <title>Using <acronym>ZFS</acronym> with >+ <application>bhyve</application> Guests</title> >+ >+ <para>If <acronym>ZFS</acronym> is available on the host >+ machine, using <acronym>ZFS</acronym> volumes >+ instead of disk image files can provide significant >+ performance benefits for the guest <acronym>VMs</acronym>. A >+ <acronym>ZFS</acronym> volume can be created by:</para> >+ >+ <screen>&prompt.root; <userinput>zfs create -V<replaceable>16G</replaceable> -o volmode=dev <replaceable>zroot/linuxdisk0</replaceable></userinput></screen> >+ >+ <para>When starting the <acronym>VM</acronym>, specify the >+ <acronym>ZFS</acronym> volume as the disk drive:</para> >+ >+ <screen>&prompt.root; <userinput>bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,<replaceable>tap1</replaceable> -s3:0,virtio-blk,<replaceable>/dev/zvol/zroot/linuxdisk0</replaceable> \ >+ -l com1,<replaceable>stdio</replaceable> -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput></screen> >+ </sect2> >+ > <sect2 xml:id="virtualization-bhyve-nmdm"> > <title>Virtual Machine Consoles</title> > > <para>It is advantageous to wrap the > <application>bhyve</application> console in a session > management tool such as <package>sysutils/tmux</package> or > <package>sysutils/screen</package> in order to detach and > reattach to the console. It is also possible to have the > console of <application>bhyve</application> be a null modem > device that can be accessed with <command>cu</command>. To do > this, load the <filename>nmdm</filename> kernel module and > replace <option>-l com1,stdio</option> with > <option>-l com1,/dev/nmdm0A</option>. The > <filename>/dev/nmdm</filename> devices are created > automatically as needed, where each is a pair, corresponding > to the two ends of the null modem cable > (<filename>/dev/nmdm1A</filename> and > <filename>/dev/nmdm1B</filename>). See &man.nmdm.4; for more > information.</para> > > <screen>&prompt.root; <userinput>kldload nmdm</userinput> >-&prompt.root; <userinput>bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap1 -s 3:0,virtio-blk,./linux.img \ >--l com1,<replaceable>/dev/nmdm0A</replaceable> -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput> >-&prompt.root; <userinput>cu -l /dev/nmdm0B -s 9600</userinput> >+&prompt.root; <userinput>bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,<replaceable>tap1</replaceable> -s 3:0,virtio-blk,<replaceable>./linux.img</replaceable> \ >+ -l com1,<replaceable>/dev/nmdm0A</replaceable> -c <replaceable>4</replaceable> -m <replaceable>1024M</replaceable> <replaceable>linuxguest</replaceable></userinput> >+&prompt.root; <userinput>cu -l <replaceable>/dev/nmdm0B</replaceable> -s 9600</userinput> > Connected > > Ubuntu 13.10 handbook ttyS0 > > handbook login:</screen> > </sect2> > > <sect2 xml:id="virtualization-bhyve-managing"> > <title>Managing Virtual Machines</title> > > <para>A device node is created in <filename > role="directory">/dev/vmm</filename> for each virtual > machine. This allows the administrator to easily see a list > of the running virtual machines:</para> > > <screen>&prompt.root; <userinput>ls -al /dev/vmm</userinput> > total 1 > dr-xr-xr-x 2 root wheel 512 Mar 17 12:19 ./ > dr-xr-xr-x 14 root wheel 512 Mar 17 06:38 ../ > crw------- 1 root wheel 0x1a2 Mar 17 12:20 guestname > crw------- 1 root wheel 0x19f Mar 17 12:19 linuxguest > crw------- 1 root wheel 0x1a1 Mar 17 12:19 otherguest</screen> > > <para>A specified virtual machine can be destroyed using > <command>bhyvectl</command>:</para> > > <screen>&prompt.root; bhyvectl --destroy --vm=<replaceable>guestname</replaceable></screen> > </sect2> > > <sect2 xml:id="virtualization-bhyve-onboot"> > <title>Persistent Configuration</title> > > <para>In order to configure the system to start > <application>bhyve</application> guests at boot time, add > the following entries to in the following files:</para> > > <procedure> > <step> > <title><filename>/etc/sysctl.conf</filename></title> > > <programlisting>net.link.tap.up_on_open=1</programlisting> > </step> > > <step> > <title><filename>/boot/loader.conf</filename></title> > > <programlisting>vmm_load="YES" > nmdm_load="YES" > if_bridge_load="YES" > if_tap_load="YES"</programlisting> > </step> > > <step> > <title><filename>/etc/rc.conf</filename></title> > > <programlisting>cloned_interfaces="<replaceable>bridge0</replaceable> <replaceable>tap0</replaceable>" > ifconfig_bridge0="addm <replaceable>igb0</replaceable> addm <replaceable>tap0</replaceable>"</programlisting> > </step> > </procedure> > </sect2> > <!-- > Note: There is no working/end-user ready Xen support for FreeBSD as of 07-2010. > Hide all information regarding Xen under FreeBSD. > > <sect2 id="virtualization-other"> > <title>Other Virtualization Options</title> > > <para>There is ongoing work in getting > <application>&xen;</application> > to work as a host environment on &os;.</para> > </sect2> > --> > </sect1> > </chapter>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 201578
:
158786
|
158788
|
158789
|
158813
| 159023