The bottom line is that there is Debian + Xen 4.1.1, you need to install FreeBSD there. A quick reference, starting with FreeBSD 8.0, can work in Xen in PV mode, before that only the HVM mode was available and only if the kernel includes the necessary drivers and options. Also, only the i386 version works in PV mode.
There are 2 methods for installing FreeBSD on Xen:
- Creating a system image on another FreeBSD and transferring it to Xen
- Initial installation in HVM and subsequent transfer to PV
Since I don’t have another FreeBSD machine with a good upload, I decided to follow Method 2.
Training
')
We need:
- Configured dom0
- ISO image of installer (FreeBSD 8.2 should work too)
- VNC Client
If you have Mac OS X: the only VNC client that has worked for me is normal - TightVNC Java Viewer.
Initial config for xm:
kernel = "hvmloader" builder='hvm' memory = 256 name = "FreeBSD-Dev" vif = [ 'type=ioemu' ] disk = [ 'phy:/dev/tank/freebsd--disk,ioemu:hda,w', 'file:/root/FreeBSD-9.0-BETA2-i386-dvd1.iso,hdc:cdrom,r' ] device_model = 'qemu-dm' boot="cd" vnc=1 vnclisten="0.0.0.0" vncpasswd='freebsdinstall' serial='pty'
Installation
We start (xm create /path/to/freebsd.cfg), we connect via VNC. If you do not have other domains with VNC, then the port will be 5900. If Dom0 is out of sight (for NAT, for example), then you can send an ssh tunnel on the local machine. In a normal OS, this is done like this:
ssh -L 5900:127.0.0.1:5900 xx.xx.xx.xx
After that, you can connect to the domain (specify 127.0.0.1.10000 as the server). It is better to configure the network with static, with DHCP there are problems. During installation, you must specify that you want src. The installation process should not cause difficulties, but I had a problem - the lvm partition I created was exactly 20gb, and when I indicated that all 20 should be allocated under /, the system asked for 64kb for the boot loader and for some reason these 64kb were not cut off from / and as a result I got an error about the lack of space. By the way, about disco names: hda -> ad0, sda -> da0.
Putting the core
For FreeBSD to work in PV mode, you need to rebuild the kernel:
cd /sys/i386/conf/ config XEN cd ../compile/XEN ; make cleandepend && make depend && make && make install
Now we need to transfer the kernel from DomU to Dom0:
scp /boot/kernel/kernel user@ip:/path
In order to connect to the domain via the xm console, you must edit the file / etc / ttys:
... xc0 "/usr/libexec/getty Pc" vt100 on secure ttyv0 "/usr/libexec/getty Pc" xterm on secure ttyv1 "/usr/libexec/getty Pc" xterm on secure ttyv2 "/usr/libexec/getty Pc" xterm on secure </p>
I leave ttyv1 turned on so that you can boot into HVM mode, press Alt + F1 and get the console, just in case.
Run in PV mode
freebsd.cfg for PV:
kernel = "/etc/xen/freebsd/kernel" memory = 256 name = "FreeBSD0" vif = [ '' ] disk = [ 'phy:/dev/tank/freebsd--disk,ioemu:hda,w' ] extra = "boot_verbose=1" extra += ",vfs.root.mountfrom=ufs:/dev/ad0p2" extra += ",kern.hz=100" pae=1
Now we need to correct the network configuration, since now the network card is called xn0, and not rl0. Everything, at this stage you must have a fully working system.
PS
About errors please write in a personal.
UPD.
Disk Speed:
%time dd if=/dev/zero bs=1024k of=test count=1024 1024+0 records in 1024+0 records out 1073741824 bytes transferred in 10.364163 secs (103601403 bytes/sec) 0.000u 3.694s 0:10.37 35.5% 25+4753k 6+8216io 0pf+0w %time dd if=test bs=1024k of=/dev/null 1024+0 records in 1024+0 records out 1073741824 bytes transferred in 8.904045 secs (120590340 bytes/sec) 0.000u 2.458s 0:08.97 27.3% 25+4906k 8225+0io 3pf+0w