home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / 4BSD / Distributions / tips / QTR_disklabel_note < prev    next >
Encoding:
Text File  |  1998-12-27  |  9.1 KB  |  169 lines

  1.     Overcoming disklabel problems when installing 4.3BSD-Quasijarus0,
  2.             4.3BSD-Tahoe, or 4.3BSD-Reno
  3.  
  4.                 By Michael Sokolov
  5.  
  6. 1. Scope
  7.  
  8. This note applies to my 4.3BSD-Quasijarus0 release, as well as to VAX builds of
  9. CSRG's 4.3BSD-Tahoe and 4.3BSD-Reno releases. It does NOT apply to plain 4.3BSD
  10. which does not have disk labels of any kind.
  11.  
  12. 2. Problem Description
  13.  
  14. Suppose you want to install one of the above systems on a typical MicroVAX with
  15. all MSCP disks made by hell knows whom and attached to MSCP controllers also
  16. made by hell knows whom. Such disks are clearly not present in the kernel's
  17. hard-coded tables, and clearly one must use disk labels in order to use such
  18. disks. This is just an example, a large VAX can also have funny MSCP disks and
  19. hey, the kernel just can't know about every disk in the world. Also it may be
  20. the case that you consider the kernel's default partitioning unusable, in which
  21. case you would also want disk labels.
  22.  
  23. The problem is that when CSRG added disk labels to the system in the Tahoe
  24. release, they didn't bother to make any kind of standalone disk labeling
  25. facility. Eventually I will implement one in Quasijarus, but I haven't got
  26. around to that yet. Thus for 4.3BSD-Quasijarus0 you still have to use some
  27. dirty tricks to get the initial label on the disk.
  28.  
  29. How exactly does the lack of standalone disklabel support hit you? What happens
  30. is that when the kernel or any of the standalone utilities sees an unlabeled
  31. MSCP disk for which it doesn't have a default label, it creates an in-core
  32. label that defines partition a covering the entire disk and no other
  33. partitions. In particular, there is no partition for swapping. Therefore, even
  34. if you do manage to get the miniroot onto the disk somehow, you will not be
  35. able to boot it. The BSD UNIX kernel is not designed to run without swap space,
  36. ever. Custom kernels have swap device major and minor numbers compiled in, and
  37. the generic kernel always puts swap on partition b. That's right, _ALWAYS_.
  38. Even when you boot the miniroot from parition b itself. The reason it doesn't
  39. swap on top of itself is not because it disables swapping (it can't do that),
  40. but because it excludes the first n sectors from swapping (n being the size of
  41. the miniroot) and swaps on the rest of partition b. Gettind back to unlabeled
  42. disks, if you try to boot the miniroot from an unlabeled MSCP disk for which
  43. there is no default label, the kernel will panic because there is no partition
  44. b defined.
  45.  
  46. Therefore, the often-suggested approach of making a MicroVAX boot tape with
  47. tmscpboot at the beginning, booting from it, copying the miniroot, and booting
  48. it won't do you any good in most cases. Instead, I offer an alternative
  49. approach, which I have used myself to get my OS running for the very first
  50. time.
  51.  
  52. 3. Proposed Solution
  53.  
  54. 3.1. Requirements
  55.  
  56. This approach does not use the miniroot or the tape bootstrap file, so you
  57. don't need to download them. You only need the full root dump, the tar image of
  58. /usr and, if you want them, the sources. (The kernel sources are practically
  59. mandatory.)
  60.  
  61. However, there is another significant requirement. You need a copy of Ultrix,
  62. either the distribution tapes or an existing installation.
  63.  
  64. You also need at least two disks, one to hold Ultrix (at least during
  65. installation) and one to actually install BSD on. One of them must be unit 0.
  66.  
  67. 3.2. Procedure
  68.  
  69. First, if Ultrix isn't already installed on the VAX, install it. You need to
  70. actually install it and not just boot from the Ultrix tape and go into
  71. maintenance mode, since you'll need to compile and run a program under it
  72. (described below). Generally things are simpler when the BSD disk is unit 0, so
  73. I recommend installing Ultrix on a disk other than 0. This is not critical,
  74. however, so if you have Ultrix on disk 0 you can still install BSD on another
  75. disk.
  76.  
  77. Then you will need to download the special package I have prepared. It consists
  78. of the 4.3BSD-Quasijarus0 disklabel program sources packaged up to compile
  79. under Ultrix. It is is the file bsd_dlabel_under_ult.tar.gz. Download, unpack,
  80. and compile it (there is a Makefile in there). This is how you will put the BSD
  81. disk label on the disk.
  82.  
  83. The essense of the procedure is to label the disk under Ultrix, use Ultrix to
  84. extract the root and /usr filesystems onto it, and then just boot from it. What
  85. makes this possible in the first place is that BSD and Ultrix have compatible
  86. filesystems. However, you have to make sure that when you create filesystems
  87. under Ultrix, you put them precisely in the right locations on the disk where
  88. BSD will expect to find them. In practice this means that you will need to put
  89. both a BSD label and an Ultrix label on the disk, and that the two must agree
  90. on the locations and sizes of all partitions. (Ultrix has its own disk labeling
  91. mechanism completely independent from and incompatible with the BSD one.
  92. However, BSD and Ultrix put their labels in completely different locations on
  93. the disk, so they can coexist.)
  94.  
  95. First you need to decide on how you are going to partition your disk and create
  96. a disktab(5) entry for it. If you are a fan of diskpart(8), there is a copy of
  97. this program on the Ultrix unsupported subsets tape. (It's an ancient version,
  98. though, so you'll have to manually edit its output a bit before putting it into
  99. /etc/disktab.) If you aren't comfortable with diskpart(8), don't worry about
  100. it. A handheld calculator will do just as fine.
  101.  
  102. The BSD disklabel program you have just compiled will use this disktab(5) entry
  103. to create the label, thus this entry must have the required fields. For each
  104. partition from a to h, you need a px#n entry and an ox#m entry, where x is the
  105. partition letter, n is the size in sectors, and m is the starting sector.
  106.  
  107. Now it's time to actually do it: put the BSD and Ultrix labels on the disk and
  108. create the root and /usr filesystems. However, because of the way Ultrix
  109. chpt, Ultrix newfs, and BSD disklabel work, this must be done in a very
  110. specific and non-trivial order. Under Ultrix whenever you newfs partition a, it
  111. automatically smacks the Ultrix bootblocks to it. This means that if you try
  112. to put the BSD label on the disk before creating the root filesystem, the
  113. Ultrix newfs will simply trash the BSD label you have just created. Thus the
  114. BSD label must be created last. The Ultrix label must be created first,
  115. however, since without it you won't be able to create the filesystems.
  116.  
  117. The normal procedure is thus to create the Ultrix label with chpt, newfs the
  118. root and /usr filesystems, and then create the BSD label with disklabel. There
  119. is one more gotcha, though. Ultrix keeps its label in the superblock, so chpt
  120. won't work unless there is a filesystem on partition a or c already. Therefore,
  121. unless you have chosen to use the Ultrix default as your partitioning, you'll
  122. have to newfs a dummy filesystem on partition a, chpt the disk with the
  123. partitioning you want, newfs partition a and your /usr partition again, and
  124. then create the BSD label with disklabel.
  125.  
  126. When you run the BSD disklabel program, you will usually need to specify the
  127. bootblock filenames on its command line. For MicroVAXen these are rdboot and
  128. bootrd. They are present in the distributed /usr image under mdec.
  129.  
  130. When your filesystems and labels are all done, mount the filesystems under
  131. Ultrix and extract the distributed root and /usr images onto them normally.
  132.  
  133. If your BSD disk is unit 0, you are all set! Shut down Ultrix and reboot! Yay!
  134.  
  135. If, however, unit 0 is the Ultrix disk, there is one more step. The currently
  136. existing MicroVAX boot mechanism always loads the /boot program from unit 0.
  137. Thus you will need to copy it from the extracted BSD root filesystem to your
  138. Ultrix root filesystem. The Ultrix boot program is called /ultrixboot instead
  139. of /boot, so putting the BSD /boot in the root partition of the Ultrix disk
  140. won't interfere with Ultrix in any way.
  141.  
  142. Then when you want to boot BSD, you will have to do B/2 or B/3 and enter
  143. ra(n,0)vmunix at the ':' prompt, where n is the unit number of the BSD disk.
  144. Doing this every time is a royal pita, which is why I recommend putting BSD on
  145. unit 0.
  146.  
  147. 3.3. Final remarks
  148.  
  149. The above procedure will get you going. When you are satisfied with your new
  150. BSD system, there is one more step you can do. There are two filesystem flavors
  151. out there: 4.2/4.3 vintage and Tahoe vintage. Ultrix filesystems are exactly
  152. the same as 4.3BSD ones, so initially your new BSD filesystems will be 4.2/4.3
  153. vintage, since they have been created under Ultrix.
  154.  
  155. The versions of BSD described in this note normally have Tahoe vintage
  156. filesystems, which have certain improvements, but they also fully support
  157. 4.2/4.3 vintage ones, which makes the installation procedure described in this
  158. note possible.
  159.  
  160. Since Tahoe vintage filesystems are better and more native for the systems in
  161. question, when you are fully satisfied with your new BSD system, you will
  162. probably want to convert its filesystems to Tahoe vintage. This is done by
  163. running fsck -c on each of them.
  164.  
  165. According to Tahoe docs, 4.2/4.3 vintage systems treat Tahoe vintage
  166. filesystems as read-only, but experiment shows that Ultrix refuses to mount
  167. them at all. Therefofe, convert your filesystems only when you are sure that
  168. you will never need to mount them under Ultrix again.
  169.