FreeNAS 8 under KVM

FreeNAS 8 runs nicely under Linux KVM virtualisation. But unlike FreeNAS 7, FreeNAS 8 is based on FreeBSD 8.2. This means that there are some configuration differences. The main one is the network device model type='ne2k_pci' does not seem to work for FreeBSD 8.2 or FreeNAS 8.

So if you're having trouble getting the networking to work, try using model type='rtl8139'. And you will need at least 1GB for the OS drive, otherwise the installation will fail silently.

Below is a working scripted install that we used on one of our lab computers to successfully install FreeNAS 8 using KVM. NB: Install FreeNAS onto the smaller disk (ad0), which is the second one in the list shown during installation. You will need to adjust the script as necessary for your setup:

#!/bin/bash

NAME='freenas8-node01'
DISK='32'
ISO='/srv/iso/FreeNAS-8.0-RELEASE-amd64.iso'

lvcreate -n lv_${NAME}_os -L 1G vg_vm && \
lvcreate -n lv_${NAME}_storage -L ${DISK}G vg_vm && \
virt-install \
  -n${NAME}  \
  -r 2048 \
  --vcpus=2 \
  --autostart \
  --os-type unix \
  --hvm \
  --os-variant=freebsd7 \
  --accelerate \
  -v \
  --network bridge=br0,model=rtl8139 \
  --disk path=/dev/vg_vm/lv_${NAME}_os \
  --disk path=/dev/vg_vm/lv_${NAME}_storage \
  -c ${ISO} \
  --vnc --vnclisten=0.0.0.0         <domain type='kvm'>

And the resulting domain config:

<domain type='kvm'>
  <name>freenas8-node01</name>
  <uuid>d11ab959-4665-6dce-d680-a4911e0120ad</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.12'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/vg_vm/lv_freenas8-node01_os'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/vg_vm/lv_freenas8-node01_storage'/>
      <target dev='hdb' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='1'/>
    </disk>
    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:e1:8b:47'/>
      <source bridge='br0'/>
      <model type='rtl8139'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>

— Andrew


Next entry

Previous entry

Related entries

Similar entries


Comments

  1. TooMeeK
    TooMeeK on 06/26/2011 10:31 p.m.

    Hello, just installing same machine under KVM. I'm not new to KVM, but now I'm trying to reach.. 2Gbit from Client to VM which is FreeNAS 8 32bit.
    I have Win7x64 client with 2xGigabit LACP bridged cards (onboard and Intel PRO/1000 Fiber teamed by Intel's software) and also the hypervisor uses bond0 for bridge br0 with 2 NICs: onboard and Intel PRO/1000 F, both LACP. But only on Debian VM Virtio NIC can be used to reach ~890Mbits for single NIC. And also I see none of BONDING modes work for VMs like FreeNAS. :(
    Any ideas how to reach at least 2Gbit??


Pingbacks

Pingbacks are open.


Post your comment





Site theme originally by styleshout.com