# Booting FreeBSD 9 from external USB HDD on a Macbook



## josser (Aug 10, 2012)

Hi everyone! 
Sorry for my bad English, hope you all guys understand what I'm talking about. 

I'm trying to install FreeBSD on external USB drive on my macbook pro. As it turned out it's not so easy.

I'm installing FreeBSD on GPT disk (750Gb) and I want following partition table:

[600Gb HFS+]
[64K freebsd-boot]
[145Gb freebsd-ufs]
[4GB freebsd-swap]

This is default layout which is suggested by FreeBSD 9 sysinstall. 
Installation finished without any problems.

I'm using this guide: http://www.glenbarber.us/2011/11/12/Dual-Booting-OS-X-and-FreeBSD-9.html 
and after installation I open LiveCD shell and install boot loader: 

`# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 3 da0`

Than I tried to boot but no luck. 
OS X boot menu doesn't show anything except my internal HDD with OSX and recovery partition. 

After that, I decide to install refit. For some reason refit item doesn't showing in boot menu. 
Because of that I install refit to my  4Gb usb-flash key. Than I see menu item but it don't recognize any FreeBSD installations. 

Interesting thing: 
I tried several times to install with different layout. And what I found, if I have clean HDD with layout: 

[600Gb HFS+]
[150Gb freespace]

and install refIT, I see refit menu item in boot menu. 
But just after FreeBSD installation it disappearing.

Another interesting thing, here is my current layout: 
`# diskutil list`

```
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *750.2 GB   disk1
   1:                        EFI                         209.7 MB   disk1s1
   2:                  Apple_HFS josser-netdrive         600.0 GB   disk1s2
   3: 83BD6B9D-7F41-11DC-BE0B-001560B84F0F               65.5 KB    disk1s3
   4:                FreeBSD UFS                         145.0 GB   disk1s4
   5:               FreeBSD Swap                         4.3 GB     disk1s5
```

Notice that instead of "FreeBSD Boot" I have that strange UID. 

After a lot of tries I'm even tried to install grub2 efi module, it successfully loaded and even able to see FreeBSD partitions. 
I tried this commands: 

```
set root=(hd0,3)
kfreebsd /boot/kernel/kernel
kfreebsd_loadenv /boot/device.hints
boot
```
But again, no luck. It just show me black screen for a 20-30 seconds than reboot. 

So, guys, can anybody point me to good article or just give some directions what to read? 
Oh, yeah, I don't want to use virtualbox.

Thanks, and again, sorry for my bad english


----------



## SirDice (Aug 10, 2012)

Have a look here: http://wiki.freebsd.org/AppleMacbook/


----------



## josser (Aug 10, 2012)

SirDice said:
			
		

> Have a look here: http://wiki.freebsd.org/AppleMacbook/



Already do this, but this article is all about 8.0/8.1. 
As I understand 9.0 installer is able to install on GPT disk without additional actions needed.


----------



## josser (Aug 12, 2012)

Also, the problem with this guide is that it assume that I can use Bootcamp. 
But I can't because it don't want to create windows partitions on USB-drive.


----------



## Jsanchez (Aug 12, 2012)

I have a Macbook, default install doesn't work. Had to fall back to mbr for single install.

Why not fallback to mbr on external drive, never used reFIT but it should handle MBR quite well.


----------



## josser (Aug 14, 2012)

Huh, I just forget about this option, MBR + reFIT. Thanks a lot!  
The only question: is it possible to convert GPT to MBR without data loss. But it not for this thread and even forum


----------



## josser (Aug 16, 2012)

Ok, I reformat my USB drive to MBR. 
Refit now see the FreeBSD installation! (It show menu option like: Boot FreeBSD from partition 2)
But don't boot.  Saying: Invalid boot device. Insert boot disk and press any key. Not sure who is talking this. (EFI, reFIT or maybe freebsd bootloader?)

I tried to use grub2 for booting, tried several configurations. 
This one: 

```
set root=(hd0,msdos2)
chainloader+1
```
don't work. Error is: invalid EFI file path. 

This one: 

```
set root=(hd0,msdos2)
kFreebsd = /boot/kernel/kernel
kFreebsd_loadenv = /boot/device.hints
```
just freeze  

Any suggestions?


----------



## Jsanchez (Aug 16, 2012)

Have you marked the partition as bootable?


----------



## Jsanchez (Aug 16, 2012)

josser said:
			
		

> Also, the problem with this guide is that it assume that I can use Bootcamp.
> But I can't because it don't want to create windows partitions on USB-drive.



BTW, the guides start with bootcamp because by using bootcamp, OS X knows that another OS Exists and Emulates MBR, that's why, most of the time, you create the partition NTFS and just wipe it out for another OS.


----------



## josser (Aug 17, 2012)

Jsanchez said:
			
		

> Have you marked the partition as bootable?



I guess, bsdinstall made this automatically: 

`$sudo fdisk /dev/disk1 

Disk: /dev/disk1	geometry: 91201/255/63 [1465149168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: AF 1023 254  63 - 1023 254  63 [         2 - 1172137144] HFS+        
*2: A5 1023 255  63 - 1023 255  63 [1172137176 -  291504087] FreeBSD     
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused`


----------



## josser (Aug 31, 2012)

Heh, hello again everyone, look what I'm found: 

https://bugzilla.redhat.com/show_bug.cgi?id=746901 

I repeat all steps to create hybrid MBR/GPT partition scheme as described in this bug report but no luck  
Looks like there some differences between booting from internal disc and external USB-hdd.


----------



## holms (Oct 27, 2012)

SirDice said:
			
		

> Have a look here: http://wiki.freebsd.org/AppleMacbook/



what this link has in common with apple bootloader at all??? Anybody successive to load that external drive or not?? I even fully reformated usb drive and allowed bsd to feel partition tables automatically.. tried that gpart bootloader also, nothing works, still can't get it to show in the menu. any serious solutions in here?


----------

