Discussion:
Minimum size of freebsd-boot
(too old to reply)
Manish Jain
2018-06-21 16:15:38 UTC
Permalink
Hi,

Under GPT, FreeBSD needs a freebsd-boot partition of max size 512 KB. Is
there a minimum size too ?

Tx
Manish Jain
Michael Sierchio
2018-06-21 16:39:20 UTC
Permalink
Under GPT, FreeBSD needs a freebsd-boot partition of max size 512 KB...
Not so. 64k works just fine. The binary /boot/gptboot is 60258 bytes. A
snippet of the code I use to build hosts. Note that subsequent partitions
are forced to be aligned on 64k boundaries.

# add boot partition

# p1

gpart add -t freebsd-boot -l ${PFX}-boot -s 64k ${DISK}


# put boot code in boot partition

gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ${DISK}


# add root, make sectors aligned

# p2

gpart add -t freebsd-ufs -l ${PFX}-root -a 64k -s ${ROOTSIZ} ${DISK}
--
"Well," Brahma said, "even after ten thousand explanations, a fool is no
wiser, but an intelligent person requires only two thousand five hundred."

- The Mahābhārata
Michael Sierchio
2018-06-21 16:41:04 UTC
Permalink
It's worth mentioning that if you're going to reuse a disk with a gpart
table already on the disk, do something to remove it

offset=`diskinfo $DISK | awk '{ print $4 - 129 }'`

dd if=/dev/zero of=/dev/$DISK bs=64k count=1

dd if=/dev/zero of=/dev/$DISK seek=$offset
Post by Michael Sierchio
Under GPT, FreeBSD needs a freebsd-boot partition of max size 512 KB...
Not so. 64k works just fine. The binary /boot/gptboot is 60258 bytes. A
snippet of the code I use to build hosts. Note that subsequent partitions
are forced to be aligned on 64k boundaries.
# add boot partition
# p1
gpart add -t freebsd-boot -l ${PFX}-boot -s 64k ${DISK}
# put boot code in boot partition
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ${DISK}
# add root, make sectors aligned
# p2
gpart add -t freebsd-ufs -l ${PFX}-root -a 64k -s ${ROOTSIZ} ${DISK}
--
"Well," Brahma said, "even after ten thousand explanations, a fool is no
wiser, but an intelligent person requires only two thousand five hundred."
- The Mahābhārata
--
"Well," Brahma said, "even after ten thousand explanations, a fool is no
wiser, but an intelligent person requires only two thousand five hundred."

- The Mahābhārata
Christos Chatzaras
2018-06-21 16:43:50 UTC
Permalink
64KB works fine, but I recommend you do it 512KB just in case future releases need to save there more data.
Hi,
Under GPT, FreeBSD needs a freebsd-boot partition of max size 512 KB. Is there a minimum size too ?
Tx
Manish Jain
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
Polytropon
2018-06-21 16:48:26 UTC
Permalink
Post by Manish Jain
Under GPT, FreeBSD needs a freebsd-boot partition of max size 512 KB. Is
there a minimum size too ?
The minimum size depends on what you require on the
/boot partition. The ZFS loader is bigger than the
classic UFS-only loader. Older FreeBSD documentation
suggested a smaller size (approx. 40 kB) which today
probably wouldn't be sufficient.

Note that the whole partition is loaded into memory.
And partition alignment is also important. That's why
512 kB is a good value (2^9). :-)

Subsequent partitions typically start at the next
multiple of 1 MB (which fits both 512 B and 4 kB
sector size). So you could try to create a smaller
/boot partition, but the next one, maybe / or swap,
would start at 1 MB anyway.



Also see:

http://www.wonkity.com/~wblock/docs/html/disksetup.html

https://www.freebsd.org/doc/handbook/bsdinstall-partitioning.html

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211361

https://forums.freebsd.org/threads/freebsd-boot-size.64794/
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
Arthur Chance
2018-06-22 15:17:19 UTC
Permalink
Post by Manish Jain
Hi,
Under GPT, FreeBSD needs a freebsd-boot partition of max size 512 KB. Is
there a minimum size too ?
It's a while since I looked at the boot loaders but it used to be that
512kB was the *maximum* partition size allowed and the first stage boot
code would fail if it was bigger. This was with BIOS booting from a GPT
disk.
--
An amusing coincidence: log2(58) = 5.858 (to 0.0003% accuracy).
Matthias Fechner
2018-06-23 07:23:53 UTC
Permalink
Post by Manish Jain
Under GPT, FreeBSD needs a freebsd-boot partition of max size 512 KB.
Is there a minimum size too ?
I use:

gpart add -a 4k -s 128M -t efi ada0
gpart add -a 4k -s 256K -t freebsd-boot -l boot0 ada0
gpart add -a 4k -t freebsd-zfs -l zroot0 ada0

This will create a 128MB partition to use EFI if wanted.
Create a 256KB boot partition which is more than enough.
Use the rest for a ZFS setup.

Gruß
Matthias
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
Loading...