Difference between revisions of "FreeBSD Guest Notes"

From Proxmox VE
Jump to navigation Jump to search
m
(32 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
Tweaks and tips for better performance with FreeBSD on KVM.
+
Setting up a FreeBSD Guest on PVE.
 +
:'''Note:''' This has been tested with FreeBSD 10.3 RELEASE (and patch levels). Some steps have been removed as they have been deprecated in newer FreeBSD versions.
  
:'''Note:''' This has only been tested with FreeBSD 9.0-RELEASE (and patch levels).
+
==Create VM==
==Enable Virto==
+
* Download the FreeBSD 10.3-RELEASE-amd64 DVD ISO (from [http://www.freebsd.org/where.html here]) and transfer it to your VM server.
* Install virtio-kmod:
+
* Create a new VM:
<pre>
+
** CPU: dual-socket and/or dual-core
cd /usr/ports/emulators/virtio-kmod && make clean install
+
** RAM: 2GB (minimum)
</pre>
+
** Network: Virtio
* When prompted on each required package, accept defaults and OK.
+
** Disk: 32GB (or higher), virtio, qcow2
* Copy the virtio modules into <code>/boot/kernel</code> directory:
+
** Add FreeBSD 10.3-RELEASE-amd64 DVD ISO as an optical drive.
<pre>
+
 
cp -Rp /usr/local/modules/* /boot/kernel/
+
==Install FreeBSD==
kldxref /boot/kernel
+
* Power on the VM.
</pre>
+
* It should boot to the FreeBSD 10.3-RELEASE-amd64 DVD ISO.
* Add the following to <code>/boot/loader.conf</code>:
+
* System Components: Disable optional (games, etc).
 +
* Disks: Auto (ZFS) Guided Root-on-ZFS, stripe virtual device, choose vtbd0 VirtIO Block Device.
 +
* Network: Choose vtnet0 VirtIO Networking Adapter. Use ipv4 only (unless you also use ipv6).
 +
* Services: Add ntpd.
 +
* This should leave you with FreeBSD 10.3-RELEASE installed on the primary drive.
 +
* Shut down the VM after installation.
 +
* Remove the ISO from the VM's optical drive (set to empty).
 +
* Verify the VM's boot order is set to the primary hard disk first.
 +
 
 +
==First Boot==
 +
* Power on the VM and log in.
 +
* Set the time:
 
<pre>
 
<pre>
virtio_load="YES"
+
ntpdate -s pool.ntp.org
virtio_pci_load="YES"
 
virtio_blk_load="YES"
 
if_vtnet_load="YES"
 
virtio_balloon_load="YES"
 
 
</pre>
 
</pre>
* Enable virtio for disk by changing your <code>/etc/fstab</code> entries to use the '''vtbd''' prefix. Example:
+
* Update the system:
 
<pre>
 
<pre>
# Device        Mountpoint      FStype  Options Dump    Pass#
+
freebsd-update fetch
/dev/vtbd0p2    /              ufs    rw      1      1
+
freebsd-update install
/dev/vtbd0p3    none            swap    sw      0      0
 
</pre>
 
* Enable virtio for network by changing the <code>ifconfig_em0="DHCP"</code> line in <code>/etc/rc.conf</code> to:
 
<pre>
 
ifconfig_vtnet0="DHCP"
 
</pre>
 
* Shutdown the VM
 
<pre>
 
shutdown -p now
 
</pre>
 
* Change network and disk drivers to virtio.
 
* Power on the VM.
 
* Verify that virtio is loading:
 
<pre>
 
kldstat
 
 
 
Id Refs Address            Size    Name
 
1  12 0xffffffff80200000 11cdab0  kernel
 
2    5 0xffffffff813ce000 4ca0    virtio.ko
 
3    1 0xffffffff813d3000 5880    virtio_pci.ko
 
4    1 0xffffffff813d9000 5010    virtio_blk.ko
 
5    1 0xffffffff813df000 aeb0    if_vtnet.ko
 
6    1 0xffffffff813ea000 3210    virtio_balloon.ko
 
 
</pre>
 
</pre>
==External Links==
+
* Reboot
* [http://viktorpetersson.com/2012/01/16/how-to-upgrade-freebsd-8-2-to-freebsd-9-0-with-virtio/ How to upgrade FreeBSD 8.2 to FreeBSD 9.0 with Virtio] - contains useful information on setting up virtio on freebsd 9.
 
* [http://www.freshports.org/emulators/virtio-kmod FreshPorts virtio-kmod] page.
 

Revision as of 19:43, 27 April 2016

Setting up a FreeBSD Guest on PVE.

Note: This has been tested with FreeBSD 10.3 RELEASE (and patch levels). Some steps have been removed as they have been deprecated in newer FreeBSD versions.

Create VM

  • Download the FreeBSD 10.3-RELEASE-amd64 DVD ISO (from here) and transfer it to your VM server.
  • Create a new VM:
    • CPU: dual-socket and/or dual-core
    • RAM: 2GB (minimum)
    • Network: Virtio
    • Disk: 32GB (or higher), virtio, qcow2
    • Add FreeBSD 10.3-RELEASE-amd64 DVD ISO as an optical drive.

Install FreeBSD

  • Power on the VM.
  • It should boot to the FreeBSD 10.3-RELEASE-amd64 DVD ISO.
  • System Components: Disable optional (games, etc).
  • Disks: Auto (ZFS) Guided Root-on-ZFS, stripe virtual device, choose vtbd0 VirtIO Block Device.
  • Network: Choose vtnet0 VirtIO Networking Adapter. Use ipv4 only (unless you also use ipv6).
  • Services: Add ntpd.
  • This should leave you with FreeBSD 10.3-RELEASE installed on the primary drive.
  • Shut down the VM after installation.
  • Remove the ISO from the VM's optical drive (set to empty).
  • Verify the VM's boot order is set to the primary hard disk first.

First Boot

  • Power on the VM and log in.
  • Set the time:
ntpdate -s pool.ntp.org
  • Update the system:
freebsd-update fetch
freebsd-update install
  • Reboot