- Create 5GB FreeBSD image.
- Install FreeBSD on xhyve.
- Mount host directory.
$ brew install xhyve --HEAD
This turorial creates 5G image.
$ cd /path/to/workdir
$ mkfile 5g fbsd.img
- Donwload FreeBSD installer(FreeBSD-10.2-RELEASE-amd64-bootonly.iso) from freebsd.org.
$ ls
FreeBSD-10.2-RELEASE-amd64-bootonly.iso fbsd.img
- Create install script (xhyverun-fbsdinstall.sh)
#!/bin/sh
UUID="-U deaddead-dead-dead-dead-deaddeaddead"
USERBOOT="/Library/Caches/Homebrew/xhyve--git/test/userboot.so"
BOOTVOLUME="FreeBSD-10.2-RELEASE-amd64-bootonly.iso"
IMG="fbsd.img"
KERNELENV=""
MEM="-m 2G"
SMP="-c 2"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
NET="-s 2:0,virtio-net"
IMG_CD="-s 3:0,ahci-cd,FreeBSD-10.2-RELEASE-amd64-bootonly.iso"
IMG_HDD="-s 4:0,virtio-blk,$IMG"
LPC_DEV="-l com1,stdio"
ACPI="-A"
xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UUID -f fbsd,$USERBOOT,$BOOTVOLUME,"$KERNELENV"
- Run
$ sudo xhyverun-fbsdinstall.sh
- Create run script(xhyverun-fbsd.sh).
#!/bin/sh
UUID="-U deaddead-dead-dead-dead-deaddeaddead"
USERBOOT="/Library/Caches/Homebrew/xhyve--git/test/userboot.so"
BOOTVOLUME="fbsd.img"
KERNELENV=""
MEM="-m 2G"
SMP="-c 2"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
NET="-s 2:0,virtio-net"
IMG_HDD="-s 4:0,virtio-blk,$BOOTVOLUME"
LPC_DEV="-l com1,stdio"
ACPI="-A"
xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_HDD $UUID -f fbsd,$USERBOOT,$BOOTVOLUME,"$KERNELENV"
- Run
$ sudo xhyverun-fbsd.sh
- Referenece mist64/xhyve/issues/45
$ sudo touch /etc/exports
$ sudo emacs /etc/exports
Edit /etc/exports (exports(5))
/PATH/TO/EXPORTDIR -mapall=501 -network 192.168.64.0 -mask 255.255.255.0
Reread file (nfsd(8))
$ sudo nfsd update
Mount
# mkdir /usr/home/YOU/host-shared
# sudo mount 192.168.64.1:/PATH/TO/EXPORTDIR /usr/home/YOU/host-shared
Unmount
# mount
/dev/vtbd0p2 on / (ufs, local, journaled soft-updates)
devfs on /dev (devfs, local, multilabel)
192.168.64.1:/PATH/TO/EXPORTDIR on /usr/home/YOU/host-shared (nfs)
# sudo umount 192.168.64.1:/PATH/TO/EXPORTDIR