# zfs gpt gpart pmbr gptzfsboot confusion



## msteiner (Oct 12, 2010)

Hi,

I upgraded my hardware from 500mhz/320mb memory, 500gb IDE harddrive to a Atom based Intel Board 1,6ghz with 2GB memory and a 1TB harddisk SATA.

Since I have a running and configured operating system on my old harddrive, I want to move it to the new bigger disk and also want to move from ufs to zfs. I've read a lot of articles and howtos how to set up ZFS but some confusion left in my head.

Most of the howto's I've found are based on older FreeBSD versions, and all the howtos say "make this and this" but they don't explain why they do so or what are the circumstances to do it that way and not another one.

Anyway... My first point of confusion is: What kind of disk layout do I need?! GPT? MBR? BSD?!

In my new BIOS I found a option called "UEFI Support", does this have any influence on the decision of having a "special" boot partition or not?

My current try is to have my terabyte on ad6, created a GPT disklayout with gpart (of course), created with gpart a freebsd-zfs partition which resulted in having a ad6p1. I boot from a "quick and dirty setted up freebsd to recover my old system" from ad4, where I can use the ZFS filesystem with no problem.

I tried to install bootstuff with

`# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ad6`

This results in: ad6 (or ad6p1) has bootcode

but I can't boot from ad6, it says: "missing boot code".

Is it possible to have just one zfs partition on the disk, without having a explicit freebsd-boot partition?

I have to admit that I'm new to "gpart" and "zfs"... using gpart is a lot easier to use fdisk and disklabel, but I don't get it up 'n running...

Thanks in advance.

- mirko


----------



## Savagedlight (Oct 12, 2010)

This guide should be more or less correct: FreeBSD ZFS root on single drive pool

I'd strongly recommend setting up at least a mirror. Drives fail, and it's not fun to reinstall a system cause you didn't have redundancy.


----------



## jem (Oct 14, 2010)

It's almost certain that the single MBR partition entry defined in GPT's protective MBR isn't flagged active.  Intel motherboards have a habit of checking for this and refusing to boot if it's not set.  I had the same problem when I built my Atom box recently (on an Intel D510MO board).

The solution is to use the 'fdisk' command to flag the partition active, as follows:
`# fdisk -a -1 /dev/ad6`
(That's a number 1, not a letter l)

I'd advise against enabling UEFI boot in the BIOS.  I tried this on my desktop machine (also an Intel motherboard) and the only outcome was that my USB ports didn't work until the OS had loaded, preventing me from using my keyboard to enter the BIOS config or make a selection in my boot manager.  I had to use the CMOS reset jumper on the motherboard to recover from that.

I also have a guide on installing FreeBSD on a ZFS mirror.  It might be of some use.  It's here.


----------



## msteiner (Oct 15, 2010)

I retried with using a 64k freebsd-boot partition and it works perfectly (it really boots!). 


```
$ sudo gpart list
Geom name: ad6
fwheads: 16
fwsectors: 63
last: 1953525134
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: ad6p1
   Mediasize: 65536 (64K)
   Sectorsize: 512
   Mode: r0w0e0
   rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
   label: (null)
   length: 65536
   offset: 17408
   type: freebsd-boot
   index: 1
   end: 161
   start: 34
2. Name: ad6p2
   Mediasize: 1000204786176 (932G)
   Sectorsize: 512
   Mode: r1w1e2
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: disk0
   length: 1000204786176
   offset: 82944
   type: freebsd-zfs
   index: 2
   end: 1953525134
   start: 162
Consumers:
1. Name: ad6
   Mediasize: 1000204886016 (932G)
   Sectorsize: 512
   Mode: r1w1e3
```

Is it also necessary to use a freebsd-boot partition when using ufs?!


----------

