<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><font color="#0000ff">Below... apologies if I forgot something -- this is pretty much as I knew it/play it out.</font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 31, 2023 at 12:31 PM Grant Taylor via TUHS <<a href="mailto:tuhs@tuhs.org" target="_blank">tuhs@tuhs.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I've found myself wondering about partitions inside of BSD disk labels.<br>
<br>
Specifically, when and where was the convention that "a" is root, "b" is <br>
swap, etc?<br>
<br>
I also understand the "c" partition to be the entire disk, unless it <br>
isn't, at which point it's the entire slice (BIOS / MBR partition) <br>
containing the BSD disklabel and "d" is the entire disk.<br>
<br>
I also found something last night that indicated that OpenBSD uses disk <br>
labels somewhat differently than FreeBSD.<br>
<br>
Aside:  This is one of the dangers of wondering how something curious <br>
came to be and why it came to be when working on 10-15 year old FreeBSD <br>
systems.<br><br></blockquote><div><span class="gmail_default" style="font-family:arial,helvetica,sans-serif"><font color="#0000ff">A long, strange trip as were.</font></span></div><div><font color="#0000ff"><br></font></div><div class="gmail_default" style=""><font color="#0000ff"><font face="arial, helvetica, sans-serif">Step one was the introduction of DEC RP04 disks -- 19 Heads, 21 Sectors/Track, 411 cylinders or 163989 blocks which will overflow a 16-bit PDP-11 register. You find it in the V5 code, but I have Dennis's </font><font style="" face="monospace">rp.c</font><font face="arial, helvetica, sans-serif"> driver showing split the RP04 into from v6:</font></font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default"><font face="monospace" color="#38761d">struct {<br></font></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">  char    *nblocks;</font></div></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">    int     cyloff;</font></div></div></blockquote><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">} rp_sizes[] {<br></font></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">    40600,  0,              /* cyl 0 thru 202 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">  40600,  203,            /* cyl 203 thru 405 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">        9200,   0,              /* cyl 0 thru 45 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">   9200,   360,            /* cyl 360 thru 405 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">        -1,     0,              /* cyl 0 thru 327 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">  -1,     78,             /* cyl 78 thru 405 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d"> 15600,  0,              /* cyl 0 thru 77 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">   15600,  328,            /* cyl 328 thru 405 */</font></div></div></blockquote><div class="gmail_quote"><div class="gmail_default"><font face="monospace" color="#38761d">};<br></font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default"><font face="arial, helvetica, sans-serif" color="#0000ff">(V5/V6 C does not have an unsigned or longs; char * is how the compiler created a type that was treated as an unsigned 16-bit integer).</font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><font color="#0000ff"><br></font></div><div class="gmail_default" style=""><font color="#0000ff" style="font-family:arial,helvetica,sans-serif">If you look at things like the rk05 in V6, we reserve a few blocks at the end of the disk for swap.  Remember quotas and file single file management are not there yet, so the scheme with the RP04 starts to be the way of the world.  Also, remember Ted has not introduced what would later be called </font><font color="#38761d" style="" face="monospace">fsck</font><font color="#0000ff" style="font-family:arial,helvetica,sans-serif">(1), so recovery from a crash was painful.   The corruption was often on the root disk, a quick</font> <font color="#38761d" style="font-family:arial,helvetica,sans-serif">dd</font><font face="arial, helvetica, sans-serif">(1)<font color="#0000ff"> of the root FS you were quickly back - or at least bookable and then you could use  check, ncheck, </font></font><font color="#0000ff"><i style="font-family:arial,helvetica,sans-serif">et al </i><font face="arial, helvetica, sans-serif">on the other partitions.</font><br></font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><font color="#0000ff"><br></font></div><div class="gmail_default" style=""><font color="#0000ff" style="font-family:arial,helvetica,sans-serif">Also, with PWB - a new set of tools was created for disk management that Research did not pick up:  volcopy, cpio, et al.  The V6 version of PWB is where <u><b>disklabels are first added to the superblock</b></u> BTW.     In fact, when we did the original </font><font color="#38761d" style="" face="monospace">fsck</font><font color="#0000ff"><font style="" face="monospace">(</font><font face="arial, helvetica, sans-serif">8) at CMU, we had v5 </font>then<font face="arial, helvetica, sans-serif"> v6.  No, PWB pollution into our IP stream.  So the original fsck I recently recovered for V6 does not have the disklabel code in it.   When Ted goes to USG later, he adds the label support (which is why if you compile the version in the V7 addenda, it will get errors -- that one is the version on UNIX/TS - which the kernel supported </font>disklabels<font face="arial, helvetica, sans-serif">). I had to look at the code, I think labels are simple, just names not information about that specific FS.  The labels are not per disk pack.</font></font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><font color="#0000ff"><br></font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><font color="#0000ff">Meanwhile back in Murray Hill ....<br><br></font></div><div class="gmail_default" style=""><font face="arial, helvetica, sans-serif" style="color:rgb(0,0,255)">With V7, we have</font><font face="monospace" style="" color="#38761d"> long int</font><font face="arial, helvetica, sans-serif" style="color:rgb(0,0,255)">, but the partition scheme is already in use and has some nice side  effects, so it is now a feature, and with the RP06 --  so Dennis's new  scheme:</font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default"><font color="#38761d" face="monospace">struct       size<br>{<br></font></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">       daddr_t nblocks;</font></div></div><span style="color:rgb(56,118,29);font-family:monospace">int       cyloff;</span><br><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace"><br></font></div></div></blockquote></blockquote><span style="color:rgb(56,118,29);font-family:monospace">} hp_sizes[8] =</span><br><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">{</font></div></div><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">     9614,   0,              /* cyl 0 thru 22 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">   8778,   23,             /* cyl 23 thru 43 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">  0,      0,</font></div></div><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">    0,      0,</font></div></div><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">    161348, 44,             /* cyl 44 thru 429 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace"> 160930, 430,            /* cyl 430 thru 814 */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">        153406, 44,             /* cyl 44 thru 410 (rp04, rp05) */</font></div></div><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">    322278, 44,             /* cyl 44 thru 814 (rp06) */</font></div></div></blockquote><div class="gmail_quote"><div class="gmail_default"><font color="#38761d" face="monospace">};<br></font></div><div class="gmail_default"><font color="#38761d" face="monospace"><br></font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff">At this point, as Arnold said, people would change the size/shape of the tables locally by recompiling and setting up the disk they way you wanted.  It could be awkward, you typically needed a second disk pack, <i>etc</i>.</font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff"><br></font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff">With DEC's release of V7m, 2.x (2.1, I think), Fred Cantor of DEC put the first versions of labels into what would later become Ultrix-11.   That code was released to CRSG (it is also where 2.9 et al. get Fred's wonderful swapping support).   Shannon (still at DEC) helped Sam add some of that into a 4.1a/b/c stream...  This was where Sam added things like</font><font face="arial, sans-serif" color="#000000"> </font><font face="monospace" color="#38761d">newfs</font><font face="arial, sans-serif" color="#0000ff">(8) and</font><font face="arial, sans-serif" color="#000000"> </font><font color="#38761d" face="monospace">/etc/disktab</font><font face="arial, sans-serif" color="#0000ff"> and started to try to make BSD more resilient to different types of disks.   But my memory is that it was nascent in the 4.2 release, so you had</font><font face="monospace" color="#38761d"> /etc/disktab</font><font face="arial, sans-serif" color="#000000"> </font><font face="arial, sans-serif" color="#0000ff">and some of the tools but not everything until later, 4.3, when what you know today came into being.</font></div><div class="gmail_default"><font face="arial, sans-serif" color="#000000"><br></font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff">Meanwhile, in Pittsburgh ...</font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff"><br></font></div><div class="gmail_default"><font color="#0000ff" style="font-family:arial,sans-serif">CMU  is working on the Mach2.5 project.   Intel had donated some of the original 386 PC support to Rasid's group (they were partial funding) that they had developed with ISC/AT&T </font><i style="font-family:arial,sans-serif;color:rgb(0,0,255)">et al</i><font color="#0000ff" style="font-family:arial,sans-serif"> to handle things particular to the PC architecture -- such as the PC's </font><font color="#38761d" style="" face="monospace">fdisk</font><font color="#0000ff" style="font-family:arial,sans-serif">(1) since </font><font color="#0000ff">PC's have a completely different way of partitioning things. Bob Baron did the Mach version - as to what was new and what was from Intel I'm not 100% sure.  But CMU did have the tools that Intel felt they owned and were not part of System III/V.  </font></div><div class="gmail_default"><font color="#0000ff"><br></font></div><div class="gmail_default"><font color="#0000ff">The key is that a PC's </font><font color="#38761d" face="monospace">fdisk</font><font color="#0000ff">(1) - creates a UNIX partition within the DOS partition table so DOS knows to leave it alone, but then Unix sub-partitions using its own scheme.   My memory here is hazy, I think the sub-partition code Bob used is different from the ATT's 386 [which most people saw as ISC's 386/ix who did the original work under contract for AT&T] </font></div><div class="gmail_default"><font color="#0000ff"><br></font></div><div class="gmail_default"><font color="#0000ff">Meanwhile, across the pond ...</font></div><div class="gmail_default"><font color="#0000ff">Andy's team starts to want a V7 for the PC/XT and starts the Minux project.   I know they had CMU's Mach 2.5 stuff and there fdisk, while it seems to be independent (i.e. clean room) is very similar to Bob Baron's scheme.</font></div><div class="gmail_default"><font color="#0000ff"><br></font></div><div class="gmail_default"><font color="#0000ff"><br></font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff">Meanwhile, in Walnut Creek ...</font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff"><br></font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff">Jolitiz <i style=""><u>et al.</u></i> started 386BSD, which would begat FreeBSD/NetBSD/OpenBSD.    At some point, Baron's </font><font color="#38761d" face="monospace">fdisk</font><font face="arial, sans-serif" color="#0000ff"> (1) and support tools make their way to that project.</font><font face="arial, sans-serif" color="#0000ff">    This was why all the original UNIX for a PC used the same PC fdisk "type" ID number (the ISC 386/ix type -- from the original 386 port). [Linus built his own tools, which I think started from the Minux tools, and thus he did his own thing --- so Linux disks were not marked with the same types). If you look at the sources to both Mach and early 386BSD, you'll see Intel markings as well as Bob's name in a couple of places [Truth in advertising here (different story) -- I wrote most of the original AT disk driver Bill used -- I was consulting for NCR and had access to the WD specs as well as the CMU code but I was not the conduit of the CMU code base to  Bill].</font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff"><br></font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff">At some point, 386BSD started to go one way, and what would become FreeBSD started to ramp up.  Jordan Hubbard wants an "easy install" like Microsoft has for Win98, so very early FreeBSD has the first PC-based install that can run without much intervention.    At some point, Jordon or someone else in the  FreeBSD team introduced what they called slices, furthering the BSD scheme but designed to overlay the PC better.   The NetBSD folks had already split off, so they did not pick it up.  When OpenBSD split from NetBSD, they did something similar but different to FreeBSD's slices...</font></div><div class="gmail_default"><font color="#000000" face="arial, sans-serif"><br></font></div><div class="gmail_default"><font color="#000000" face="arial, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff">Meanwhile, in Cupertino ....</font></div><div class="gmail_default"><font face="arial, sans-serif" color="#0000ff"><br></font></div><div class="gmail_default"><font color="#0000ff"><font face="arial, sans-serif">Next (ney Apple) started with the Mach code base from CMU.  There was a push in the Valley in those days for something called OpenFirmware [Warner help here -- I think that it was forth based IIRC, and Sun may have had their hand in it also].  But the key is that it ran on 68K's.  </font><span style="font-family:arial,sans-serif"> So Next's original partition scheme was influenced if not based on some of Bob's work, although they did not need the silly BIOS stuff, so they did make it all talk to OpenFW (BTW: I think that was still all Next)</span></font></div><div class="gmail_default"><span style="font-family:arial,sans-serif"><font color="#0000ff"><br></font></span></div><div class="gmail_default"><span style="font-family:arial,sans-serif"><font color="#0000ff">By the time the Intel Mac's BIOS had begun to be replaced in the WINTEL world by UEFI, Apple committed to using a flavor of it. My old lab partner, Guy Sotomayer (<i>a.k.a.</i> gss on many mailing lists) was mixed up during his time at Apple. He might be able to fill in some details if I ask him.  I also know that Apple was not happy with how disks were handled with the original partition scheme, and by later release started over with their partitioning scheme(s) at least once.</font></span></div><div class="gmail_default"><span style="font-family:arial,sans-serif"><font color="#0000ff"><br></font></span></div><div class="gmail_default"><span style="font-family:arial,sans-serif"><font color="#0000ff"><br></font></span></div><div class="gmail_default"><span style="font-family:arial,sans-serif"><font color="#0000ff">I've undoubtedly left stuff out, such as much of Linux - but this is all part of the UNIX war I was a player.</font></span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div></div>