# gpart's freebsd-boot slice type



## Seeker (Feb 23, 2010)

```
# gpart show
```
Showed me this label types, on my freebsd slice:
freebsd-swap
freebsd-ufs

PS: I've never used gpart utility for creating slices, labels.
Only fdisk, newfs, bsdlabel...

So, looking at a gpart's man page, I've saw this slice type:


> _freebsd-boot   A FreeBSD partition dedicated to bootstrap code._



After examining it, in a various online examples, I can see, it is just a slice, without labels and without any kind of file systems.
It is always set, to be *very* small in size and only holds some bootstrap code in it.
As I understand, that slice boots some other slice.

So what is it used for?
My sys boots without that partition; BIOS -> MBR -> bootcode of active slice -> /boot/loader

So why bother adding extra step??
BIOS -> MBR -> *bootcode of freebsd-boot slice* -> bootcode of other slice -> /boot/loader


----------



## graudeejs (Feb 23, 2010)

It holds bootecode, same way as MBR {as I understand}

Because It's impossible to boot without freebsd-boot.


----------



## graudeejs (Feb 23, 2010)

I think it's x86 (bios or maybe even hardware) limitation.


----------



## Seeker (Feb 23, 2010)

killasmurf86 said:
			
		

> It holds bootecode, same way as MBR {as I understand}


Then why in 2 places?


			
				killasmurf86 said:
			
		

> Because It's impossible to boot without freebsd-boot.


Oh yeah?
I am booting my laptop and my server without freebsd-boot slice. 


			
				killasmurf86 said:
			
		

> I think it's x86 (bios or maybe even hardware) limitation.


I have absolutely, no idea, what are you talking about!


----------



## graudeejs (Feb 23, 2010)

you need EFI bios to boot from GPT AFAIK, or make hacks to be able to boot PC's with GPT

http://en.wikipedia.org/wiki/GUID_Partition_Table
http://en.wikipedia.org/wiki/Master_boot_record



> As of 2010, MBR-based partition table schemes insert the partitioning information in the master boot record (MBR) itself (which on BIOS system is also the container for code that begins the process of initializing the disk). In GPT, partition table information is stored in the GPT header, but to maintain compatibility, GPT retains the MBR entry as the first sector on the disk followed by a Primary Partition Table Header, the actual beginning of GPT.


----------



## Seeker (Feb 23, 2010)

I know that. Also...
I've never mentioned GPT here.
If I needed more then 4 slices or have HDD space bigger then 2TB, then I would start GPT debate. Beside that, GPT doesn't gives anything else in return, except more code mess.

Why dedicated slice called freebsd-boot, which holds only bootcode (no matter which one)?


----------



## graudeejs (Feb 23, 2010)

Hmmm, I Haven't used gpart to create MBR slices

Sorry for misunderstanding you


----------



## bschmidt (Feb 23, 2010)

Seeker said:
			
		

> So what is it used for?
> My sys boots without that partition; BIOS -> MBR -> bootcode of active slice -> /boot/loader
> 
> So why bother adding extra step??
> BIOS -> MBR -> *bootcode of freebsd-boot slice* -> bootcode of other slice -> /boot/loader



You answered your question pretty much on your own. It's only used with GPT, on GPT there are no slices, so you need a place to put the bootcode into which you would to otherwise with `# bsdlabel -B`, don't you?

The "old" fdisk/bsdlabel style uses /boot/mbr for the MBR and /boot/boot? for the slice. On GPT it usually is /boot/pmbr and /boot/gptboot for the bootcode partition. So, there is no need for a bootcode partition when using plain old MBR partitions/slices.

Hope that explains that and I'm not too wrong..


----------



## Seeker (Feb 23, 2010)

Guys!

Do you know, what I think?! :e
I think that::f





> ... -> *bootcode of freebsd-boot slice* -> ...


... just emulates EFI firmware's bootstrap steps.
It exists only because of BIOS -> MBR, style PCs.

PMBR(Protective MBR) and MBR are both on a same location and are of a same size, so it is logical that BIOS will hit it.
But PMBR contains hacked code(this is where EFI firmware emulation starts), which point further execution steps to bootcode of *freebsd-boot slice* and it contains GPT, which would normally be located just after PMBR (sector 0)

Am I right? :stud


----------

