# FreeBSD on a Mac Pro?



## Yesurbius (Oct 21, 2010)

I have a 2006 (First Gen) Mac Pro.  When I first purchased it, I had plans to run it as a server for the other five computers in my house.  I purchased four 500GB SATA drives, 8 GB of memory, and Mac OS X Server (Leopard).  

Well Leopard turned out to be one big bug farm.  I don't think I ever did get kerberos / directory services working in a stable fashion.  I ended up setting up the 3 drives as a RAID 5 stripe .. and just sharing the disk.  I spent the next three years playing WoW on the computer until the video card in the Mac went and I bought a new Gaming PC this past spring.

So now I have this rather powerful dual CPU (4 cores total) machine .. and I'm still lacking a viable home server.  I would also like to get a web server set up so I can do some Ruby / Rails test development. I'm trying to figure out the best way to utilize it.

*The Vanilla Route*
I can put it in target disk mode and use my iMac to install OS X on it.   Then I can configure my file sharing and web services natively within Mac OS X.   This presents a few problems .. because while my other Mac would connect fine - the Network storage would not be as seemless for my three other Windows 7 machines.  Also, I'd have to rip out the bundled Apache server / Rails installation in order to upgrade it to a current version.   I'd still have a fair amount of wasted resources (since its a headless machine and doesn't really need the GUI running) ..  and be limited in my remote administration abilities (VNC only)


*To Virtualize or Not?*
Another thought was to install a barebones copy of Mac OS X (Target Disk Mode, again) .. and then spend some money on VMWare Fusion .. and create two virtualized FreeBSD VMs.. one for the web work and one for the file sharing (ie. samba).   The newer samba has much cleaner Windows 7 support .. so it should be a better option for the Windows machines .. and the iMac can connect to Samba quite easy.   I'd still have a rather hefty operating system as the host OS however .. an Operating system that purely a VM host ..  And I'd still have to VNC into it to do any sort of administration.

*Uncharted Waters*
So a few other options I thought about . but not sure if they'll work in my situation...

#1.  Xen Hypervisor with FreeBSD Host OS .. and one or two FreeBSD Guest OSs (depending on my config choices).
I read that Xen supports EFI .. so it shouldn't be a problem.   Much less overhead ..  and I'd imagine Xen would make quite efficient use of the resources.   The Headless component of the situation may pose to be a problem .. I know Xen can be remotely administered .. but remotely installed?   

#2. Install FreeBSD natively as the primary OS .. skip Virtualization altogether . and just configure everything out of the box.

I'd really hate to soak any more money into this computer ..  its more to take advantage of older but still viable hardware.

Right now all my data is stored on a single 1TB drive .. so I am free to wipe the drives if needed in order to configure things .. then I can copy the data over when its all said and done.

I'm by no means a newb.  I've used Slackware Linux / Debian Linux / FreeBSD / OpenBSD / Mac OS X ..   been at this stuff for 15 years.

Any suggestions or recommendations?


----------



## SirDice (Oct 21, 2010)

#1 is not an option as there is currently no support for a FreeBSD Xen host.

I'd go with #2 even if there was. Run apache in a jail and you're pretty much good to go.


----------



## Yesurbius (Oct 21, 2010)

How is FreeBSD's compatibility with the Intel Mac systems?  Noteably EFI32, chipsets, and power management?

Yes - I must have gotten confused.  In order to do FreeBSD under Xen I'd need to run NetBSD 4 as the Host .. and set up two FreeBSD Guests.  The advantage of virtualizing my environments is that I can move them around easier without redoing the entire system.


----------



## anomie (Oct 21, 2010)

As I understand it, FreeBSD works "pretty well" on various Mac+Intel systems. Might be hit and miss - give it a shot and let us know how you get on.


----------



## vermaden (Oct 21, 2010)

@Yesurbius

How about instaliing FreeBSD natively with VirtualBox, to host virtual machones, with VBoxHeadless and/or VBoxSDL and ssh/X11 forwarding it would be very nice setup.

If You need Xen exclusively, then You can achieve that with NetBSD Xen dom0 host.


----------



## Yesurbius (Oct 22, 2010)

I could do FreeBSD natively, then run VirtualBox for subsequent VMs.   I think I'd prefer to go with a Type-1 Hypervisor instead however.  Furthmore, headless FreeBSD installation would require a serial port which Macs do not have.. so I don't know how I'd install FreeBSD without a monitor on a Mac Pro.

XenServer boots no problem on Macs .. and will happily install itself.  The caveat being that it has a detailed setup.  I don't know if it has remote setup capabilities.

I read the ESX/i had great headless modes - but when I ventured over to VMWare's site .. the ESX/i product had been replaced by vSphere .. in which the hypervisor component was being offerred free.  Sounds like a new product replacing a niche one to me.

Still searching.  Appreciate the suggestions.


----------



## Yesurbius (Oct 31, 2010)

Update on my progress.

I found a forum post that suggested using mfsbsd.  The instructions seem a bit outdated - because it seemed as if mfsbsd had been updated - there was a zfs_install script to prep the drive ...  but it didn't boot after I completed it.  I tried it on a Dell system and it worked fine ... so ....

I've thrown in an el-cheapo PCI Express video card I had laying around.  Its not Mac compatible however so the boot screen is black still.  If I boot off of the mfsbsd Live CD - video pops up the moment BTX loader initializes the console.   So I'm not entirely blind at this stage.  Unfortunately, if I boot off the FreeBSD Installation CD ..  it doesn't give me video.   Boots fine off my iMac Intel .. so I know its not a compatibility issue - I think the video just is not being initialized in the same way the live CD was initializing it.

Options I've yet to investigate:

1) See if I can't eject the Live CD from mfsbsd ..  then mount the FreeBSD install CD ... and start the install manually.
2) Investigate whether I can (blindly) access a boot prompt or something and pass options to the FreeBSD cd's kernel to initialize video.
3) Install FreeBSD onto another PC and see if I can't slipstream a custom kernel onto the install CD - with the video drivers enabled.
4) Take out the hard drive, install FreeBSD onto the drive using another machine .. configure SSH .. then plop it back into the Mac Pro.  Not sure if this will work because of the EFI ...

... that's where I'm at now.


----------



## Yesurbius (Nov 3, 2010)

Another quick update.

Turns out my optical drive worked fine with CDs .. but was giving Input/Output errors when attempting to mount the FreeBSD DVD (that booted fine on my iMac).   So located an IDE CDRom Drive and threw it into the system..  Blindly held down 'C' to boot from CD .. and boom - the BMX boot messages started appearing ..  FreeBSD 8 setup started.

So next order of business is to install to my 250GB drive .. then setup VFS on three of my 500GB drives ..  I'll transfer the backup date from my 1TB drive onto the new VFS ..  then I'll swap the 1TB drive for the 250GB and reinstall ..  adding another 500GB pool to existing VFS.

.. at least that's the plan...


----------



## Yesurbius (Nov 3, 2010)

*Another Update ...  many hours later*

Booted off of the FreeBSD 8 CD.  Went through the install but when I attempted to create the drive partitions, I received the error:


```
>> Unable to find the device node /dev/ad6s1 in /dev
```

I found and read the following posts:
http://forums.freebsd.org/showthread.php?t=18514
http://forums.freebsd.org/showthread.php?t=18400

First I tried destroying the labels on /dev/ad6 .. but even after rebooting the same problem occurred.

I read up a bit about what exactly a GPT (GUID Partition Table) was ..  realized that the Mac needs one in order for the EFI to boot it properly.  I am aware there things such as rEFIt around that replace the EFI boot manager that comes with Mac - but if anything goes wrong - I won't have video at that stage to recover from it - so its not really an option right now unless I wanted to brick it.

So following the second post, I used the DVD Live FixIT console and issued the following commands


```
gpart create -s gpt ad6
gpart bootcode -b /dist/boot/pmbr ad6

gpart add -s $(( $(du -sk /dist/boot/gptzfsboot | cut -f 1) * 2 )) -t freebsd-boot ad6
gpart bootcode -p /dist/boot/gptboot -i 1 ad6

gpart add -s 25G -t freebsd-ufs ad6
gpart add -s 8G -t freebsd-swap ad6
gpart add -s 50G -t freebsd-ufs ad6
gpart add -s 50G -t freebsd-ufs ad6
gpart add -s 50G -t freebsd-ufs ad6
gpart add -s 50G -t freebsd-ufs ad6
```

Few footnotes before proceeding.  Because I was using Fixit - the /boot options were fairly limited - but I found all of the files referenced in the instructions in /dist/boot - so I substituted.

I tried using the [cmd=]gjournal label /dev/ad6p2[/cmd] command followed by the [cmd=]newfs -J /dev/ad6p2.journal[/cmd] command - but it complained it couldn't find the device.  Also any other gjournal commands failed.  So gave up with journaling and just made the filesystem.


```
newfs /dev/ad6p2
newfs /dev/ad6p4
newfs /dev/ad6p5
newfs /dev/ad6p6
```

So next, because the sysinstall didn't work with GPT partitions - I had to get an OS onto the hard disk so I could get it working.

I mounted the new drive with [cmd=]mount /dev/ad6p2 /mnt[/cmd] and then recursively (preserving permissions) copied the contents of /dist/* to /mnt/.

When it finished - I restarted the computer ..  and it defaulted the CD. I hooked up the iMac via firewire .. put the Mac Pro into target disk mode .. and only the FreeBSD CD showed up in the iMac's boot menu.

So ..  need to spend more time on it - but not tonight.  Think tomorrow I'll try grabbing the FreeBSD Boot Only ISO .. and try putting that onto the drive instead of /dist.


----------



## Yesurbius (Nov 3, 2010)

Funny Coincidence.  Hit the forum list to see my post and I see another post there

*Installing FreeBSD 8.0 on a GPT hard drive*
http://forums.freebsd.org/showthread.php?t=15367

So maybe I'll start with those instructions tomorrow.


----------

