gpart usage



Hello,

I'm trying to setup a MBR partition with a BSD slice in it using gpart on
FreeBSD 8.1 RELEASE. From the fixit console in the install i try to do

gpart create -s MBR ad0
gpart add -t freebsd ad0
gpart create -s BSD ad0s1
gpart add -t freebsd-ufs ad0s1
gpart set -a active -i 1 ad0


For bootcode i do:
gpart bootcode -b /boot/boot0 /dev/ad0
gpart bootcode -b /boot/boot /dev/ad0s1

This seems to work, but i have doubts about it. For example, looking at:

http://freebsd.1045724.n5.nabble.com/gpart-micro-how-to-td4205149.html

I can see that it leaves a 16 sectors offset. Can't find anything about it
on gpart man page, but i did find on bsdlabel man page the following:

offset The offset of the start of the partition from the beginning of
the drive in sectors, or * to have bsdlabel calculate the correct
offset to use (the end of the previous partition plus one, ignor-
ing partition `c'). For partition `c', * will be interpreted as
an offset of 0. The first partition should start at offset 16,
because the first 16 sectors are reserved for metadata.

So seems they're needed. Looking at what sysinstall did on a 8.0 install i can
see the following:

%gpart show
=> 63 285155262 da0 MBR (136G)
63 285153687 1 freebsd [active] (136G)
285153750 1575 - free - (788K)

=> 0 285153687 da0s1 BSD (136G)
0 2097152 1 freebsd-ufs (1.0G)
2097152 8388608 2 freebsd-swap (4.0G)
[ more skipped ]

Ie, no 16 sector offset in it. So my question is... What's the proper way of
doing a MBR + BSD label partition and where is it documented? what are the different
bootcodes and when is needed each one?[1] also, how do i know about offsets each
partitioning scheme needs? shouldn't GEOM take care of it without user needing to
know anything about it?

If i wanted to also align partition to 1 MB offsets so i can get better performance
with advanced format drives and RAID controllers, what would be the best option?
I guess that i would need to add the first freebsd-ufs partition starting at 1985
sector, because 1 MB = 2048 512byte sector, and 63 are reserved for MBR scheme
so 2048 - 63 = 1985. Is this right or i'm mistaken in something?

Seems that gpart man page only documents doing it with GPT and doesn't talk
about alignment constraints, but i can't use GPT because i want to do it over
gmirror and last sector is used by gpt and gmirror at the same time causing
some warnings[2].

It would be great if handbook's GEOM chapter would have some part about
using gpart, but of course it's easier asking for it than actually writting it.

Thanks a lot.
Regards.

[1]: I know handbook does have some info about /boot/boot0, boot1 and boot in
"The Boot Manager and Boot Stages", but i can't find info about for example
gptboot or gptzfsboot.

[2]: Yes i know that i can create the GPT scheme and then gmirror the partitions
but then, i can't use with the same speed the gmirror load algorithms over both
disks so i prefer to gmirror the whole device.

--
La prueba más fehaciente de que existe vida inteligente en otros
planetas, es que no han intentado contactar con nosotros.
_______________________________________________
freebsd-stable@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: RFC: making gpart default
    ... I'd like to switch all architectures to gpart for the reasons given ... we only look at the aspects that affect FreeBSD, ... stored in partition that previously contained a filesystem, ... partition types are abstracted so that the ...
    (freebsd-arch)
  • gpart on macbook air
    ... (internal ssd as you know): ... on freebsd, deleting a partition with gpart: ...
    (freebsd-current)
  • Re: gpart and mbr give "no operating system" message at boot.
    ... installation using gpart to install an MBR partition. ... The system is an existing FreeBSD 5.2.1 system at a remote location (ie impossible to boot ... If I follow the same procedure but create a gpt partition it works swimmingly. ...
    (freebsd-questions)
  • Re: BSDInstaller snapshot
    ... first partition at offset 16. ... What is this metadata on those ... already installed FreeBSD without destroying it? ...
    (freebsd-current)
  • Should newfs include -S 4096? was Re: boot problem after freebsd-update from 9.1-RC2 to
    ... freebsd-update upgrade -r 9.1-RC1 ... I'm starting to think having the swap partition in gm0s1a and the booting UFS partition in ada0s1b is the problem: ... gpart create -s BSD mirror/gm0s1 ... Will this impact performance or longevity of the mirror? ...
    (freebsd-questions)