Migrating the FortiManager from VMWare ESXi to FreeBSD bhyve.
Be aware you doing this on your own without any support from Fortinet. bhyve is not a supported platform.
Create the Switch
We need to create a network swith if there is non.
vm switch create FMG-SW
vm switch list
ifconfig FMG-SW
Add an uplink port
vm switch add FMG-SW em0
Create the VM
vm create fmg
We create only the VM as container, we will replace this with our own disks and settings.
VM Configuration
Booting the Kernel
loader="grub"
grub_run_partition="1"
# loglevel=3 consoleblank=0 panic=5 console=tty0 console=ttyS0,9600 rdinit=/bin/init initrd=/rootfs.gz BOOT_IMAGE=vmlinuz
grub_run0="linux /vmlinuz rdinit=/bin/init consoleblank=0 console=ttyS0 loglevel=3"
grub_run1="initrd /rootfs.gz"
CPU / RAM
cpu="2"
memory="4096"
Harddisks
disk0_type="ahci-hd"
disk0_name="disk0.img"
disk1_type="ahci-hd"
disk1_name="disk1.img"
Network
network0_switch="FMG-SW"
network0_type="e1000"
network1_switch="FMG-SW""
network1_type="e1000"
network2_switch="FMG-SW""
network2_type="e1000"
network3_switch="FMG-SW""
network3_type="e1000"
The Harddisks
The Fortimanger comes with two disks.
Disk0 is a 2GB disk with the boot loader and the OS image.
Convert the Harddisks from vmdk to raw
qemu-img convert -f vmdk disk0.vmdk -O raw disk0.img
Disk1 is the datadisk.
Disk0
Lets see how the Image looks like.
fdisk -lu disk0.img
Disk disk0.img: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
disk0.img1 * 8192 2105343 2097152 1G 83 Linux
Weed need to know the Start Sector and the Sector Size to calculate the Start for losetup on a Linux Sytem to mount the drive.
Start is 8192
Sector is 512
8192 * 512 = 4194304
losetup -o 4194304 /dev/loop0 disk0.img
Now we can mount this
mount /dev/loop0 /mnt
Disk 1
Now lets have a look on the the Second disk
fdisk -lu disk1.img
Disk disk1.img: 80 GiB, 85899345920 bytes, 167772160 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
This looks like a raw disk or physical disk for an volume group. So we create the loop directly with the image.
losetup /dev/loop1 disk1.img
True this is a LVM physical volume.
pvdisplay /dev/loop1
WARNING: PV /dev/loop1 in VG mdvg is using an old PV header, modify the VG to update.
--- Physical volume ---
PV Name /dev/loop1
VG Name mdvg
PV Size 80.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 20479
Free PE 0
Allocated PE 20479
PV UUID xxx
vgscan
WARNING: PV /dev/loop1 in VG mdvg is using an old PV header, modify the VG to update.
Found volume group "mdvg" using metadata type lvm2
vgdisplay
WARNING: PV /dev/loop1 in VG mdvg is using an old PV header, modify the VG to update.
--- Volume group ---
VG Name mdvg
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 0
Max PV 0
Cur PV 1
Act PV 1
VG Size <80.00 GiB
PE Size 4.00 MiB
Total PE 20479
Alloc PE / Size 20479 / <80.00 GiB
Free PE / Size 0 / 0
VG UUID xxx
lvdisplay
WARNING: PV /dev/loop1 in VG mdvg is using an old PV header, modify the VG to update.
--- Logical volume ---
LV Path /dev/mdvg/mdlv
LV Name mdlv
VG Name mdvg
LV UUID xxx
LV Write Access read/write
LV Creation host, time (none), 2020-04-22 17:31:08 +0200
LV Status available
# open 0
LV Size <80.00 GiB
Current LE 20479
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
So now we have an idea how the Harddisks look like we can start configuring the VM


2 Replies to “FreeBSD bhyve – FortiManager”
Comments are closed.