Re: gpart -t option incorrect in manpages (14.2-RELENG)
Date: Sat, 18 Jan 2025 20:18:20 UTC
On Sat, Jan 18, 2025 at 10:49 AM void <void@f-m.fm> wrote: > Hi, > > context is freebsd 14.2-releng vm (amd64) that has been upgraded with > freebsd-update from 13.4. > > Decided to add another disk so invoking the vm looks like this: > > # sh vmrun.sh -c 4 -m 16G -t tap2 -d ./vm.img -d ./disk1.img vmname > > used gpart to create an MBR for disk1.img. tried to make slice/partition > type like so: > > root@vmname:/root# gpart add -t freebsd-ufs -a 1M -i 1 vtbd1 > gpart: Invalid argument > root@vmname:/root# gpart add -t freebsd-ufs -a 1M vtbd1 > gpart: Invalid argument > > dropped off the -ufs in freebsd-ufs > > root@vmname:/root# gpart add -t freebsd -a 1M vtbd1 > vtbd1s1 added > > Is this expected? The man page has both freebsd and freebsd-$thing, > mentions > just plain freebsd is legacy for GPT and some others, no mention of MBR > in the context. > It's expected. First, I'd skip using MBR. It's super limited, kinda hard and uses weird things. Using GPT will just work. MBR should generally only be used for legacy uses, but it should all work, once you do it correctly. So some more data. GPT is a 'flat' namespace, so you just create the partition directly. That's why '-t freebsd-ufs' works for that, but fails on MBR. MBR is nested. You create the partition for "FreeBSD" (type 0xa5 IIRC). This is because when 386BSD was done in the late 1980s, Linux didn't exist yet, and each OS would have its own partition type (one), except windows... So FreeBSD got its own partition code, which FreeBSD code calls "slices", and then uses BSD disklabel to slice that up into BSD-like partitions which are single letters. So vfbd1s1a would be the / (kinda hard wired), etc. So to fit that into GEOM, which came along in around 2000, gpart was invented (I'm skipping some history where we had separate geoms for each partitioning type). So you have to first create the partitioning scheme first (mbr). Then the FreeBSD partition (-t freebsd vtbd1 to create vtbds1) and then the partition(s) for file systems (so -t freebsd-ufs on vtbd1s1 to create vtbds1a). Since MBR is legacy, we under explain it. I think we used to have more explanation, but maybe not (gpart has always been almost descriptive enough, but also too vague). Warner