# GPT ufs boot



## andrnils (Oct 5, 2011)

Hello,

I'm trying to set up a system for nanobsd-style handling (small ro root), but I wanted to use GPT partitioning, and have so overridden the relevant part in nanobsd.sh, but now I'm a bit lost as how to set up a boot loader which allows me to choose which gpt-partition to boot.

gpart has the following to say:

```
# gpart show
=>       34  143305853  da0  GPT  (68G)
         34   12582912    1  freebsd-swap  (6.0G)
   12582946  130722941    2  freebsd-zfs  (62G)

=>     34  4194237  da1  GPT  (15G) [CORRUPT]
       34      128    1  freebsd-boot  (64K)
      162  2064384    2  freebsd-ufs  (1.0G)
  2064546  2064384    3  freebsd-ufs  (1.0G)
  4128930    65341    4  freebsd-ufs  (32M)
```
where da1 is the disk I'm booting from. The CORRUPT status I'm a bit puzzled about, but I guess it's due to the fact that the usb stick is larger than the image, so the last sector doesn't match.

Anyhow, it boots just fine, but just the da1p2 partition. I would like a way to set which one to boot.

By the way I use gpt-labels so there is no issue drive naming.

```
da1p1 -> gpt/efi
da1p2 -> gpt/p1
da1p3 -> gpt/p2
da1p4 -> gpt/cfg
```

So, how do I choose which partition to boot from? Is there a boot0 equivalent for gpt?

And as a bonus: How do I fix the gpt-scheme so I can fix the CORRUPT status?

Best regards
Andreas


----------



## jem (Oct 5, 2011)

I'm not aware of a GPT loader that can present a nice friendly boot menu, but it should be possible to select which partition to boot from after the next reboot.

From gpart(8):


```
The scheme-specific attributes for GPT:

     bootme      When set, the gptboot stage 1 boot loader will try to boot
                 the system from this partition.  Multiple partitions might be
                 marked with the bootme attribute.  In such scenario the
                 gptboot will try all bootme partitions one by one, until the
                 next boot stage is successfully entered.
```

I've not investigated setting these attributes, but presumably you can use 'gpart set' to decide which filesystem to boot from next reboot.


----------



## andrnils (Oct 7, 2011)

jem said:
			
		

> I'm not aware of a GPT loader that can present a nice friendly boot menu, but it should be possible to select which partition to boot from after the next reboot.
> 
> From gpart(8):
> 
> ...



That was a nice RTFM  I don't know why/how I missed it. I'll try it when I get out of the presentation at eurobsdcon now.

Luckily for me I don't need a way to choose, as long as everything works 

Best regards
andrnils


----------

