How to tell gptboot which slice to boot from?

Hello, forum!

After the second day of reading and googling I finally gave up on this and must ask for assistance.

I have a GUID partition table on a SATA disk and a BIOS machine with this partitioning:

# gpart show

Code:
ada0	GPT	(40G)	
1		freebsd-boot	(64k)
2		freebsd-ufs	(19G)
3		freebsd-ufs	(19G)
4		freebsd-swap	(2G)
...

The two UFS slices are intended for placing root filesystems onto. What I am trying to do is to tell the bootstrapping code which slice to boot from.

I install the boot code by:
# gpart bootcode -p /boot/gptboot -i 1 ada0

The problem is that the system always boots from the first freebsd-ufs slice (with a loader and kernel on it). Both freebsd-ufs slices do have a loader, a kernel and a complete FreeBSD installation.

How could I tell gptboot to go to the second (or another) slice when handing off to the loader?

Thanks in advance for each and every hint or solution!
 
This is really helpful, as I read about those attributes before posting, but the gpart man page don't tell us how to set them.

The gpart man page leaves however one open question: how could one clear the attributes? The bootme flag would do exactly what I need, but there should be only one slice set to bootme. If both slices are set to bootme, then the first one in order would be always booted.
 
Yes, indeed! For all interested:

gpart unset -a bootme -i <n> <device>
gpart unset -a bootonce -i <n> <device>

Actually, I am an idiot - this info is written in the gpart man page, but somehow I managed to overlook it.
 
Yes, it is--or was--in gpart(8), but that's really not the right place. I had added it there earlier, then realized only afterwards that it really ought to be part of gptboot(8), which was on my list of man pages that were missing. At the same time as adding gptboot(8), I factored most of the redundant information out, and added references to the new man page instead.
 
Warren, the man pages are good, it was my fault not reading them thoroughly. I usually first read the examples at the end, and there were none with 'unset'.

Thanks again for the help!
 
Back
Top