home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / bsd / 4320 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  7.4 KB

  1. Xref: sparky comp.unix.bsd:4320 comp.sys.ibm.pc.hardware:22073
  2. Newsgroups: comp.unix.bsd,comp.sys.ibm.pc.hardware
  3. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!barsoom!barsoom!tih
  4. From: tih@barsoom.nhh.no (Tom Ivar Helbekkmo)
  5. Subject: Re: Disklabeling (was Re: Another Adaptec Question)
  6. Message-ID: <tih.714115743@barsoom>
  7. Sender: news@barsoom.nhh.no (USENET News System)
  8. Organization: Norwegian School of Economics
  9. References: <1992Aug16.144341.24052@Informatik.TU-Muenchen.DE> <15776@star.cs.vu.nl> <1992Aug17.173807.2309@Informatik.TU-Muenchen.DE> <#79m_a.alm@netcom.com>
  10. Distribution: world,fj,spec
  11. Date: Tue, 18 Aug 1992 05:29:03 GMT
  12. Lines: 133
  13.  
  14. alm@netcom.com (Andrew Moore) writes:
  15.  
  16. >To return to 386BSD and disklabeling a SCSI drive: 
  17. >am I correct in assuming that the specification of # of cylinders,
  18. >sectors per cylinder, etc does not matter at all, so long as the total
  19. >number of blocks is correct?
  20.  
  21. No, you're not...  It *does* matter to the file system.  Although the
  22. following was written while I was trying to figure out how to set up
  23. SCSI disks correctly for Ultrix, it's relevant to any system using
  24. the Berkeley Fast File System.  This is a summary I posted to the net
  25. in comp.unix.ultrix a while back:
  26.  
  27. I recently asked how to correctly set up disk partitions for the SCSI
  28. disks connected to our DECstations, specifying some of the problems I
  29. had understanding what was right and wrong.  I've had several very
  30. interesting responses, and feel that I've learned quite a bit of
  31. useful stuff here...  Thanks go to Klaus Steinberger, Walter Wong,
  32. Mike Mitchell, and especially to Stefan Esser, who took the time to
  33. explain a lot of details to me in our email correspondence.
  34.  
  35. Anyway -- to recap my situation, I wanted to make sure I partitioned
  36. my disks so partition boundaries were placed at cylinder boundaries,
  37. and their sizes worked out properly to an integral number of cylinder
  38. groups, 16 cylinders per group being the default number.  Looking at
  39. the /etc/disktab entries for the disks helped me little, since DEC
  40. obviously hadn't cared about this in their setup, and multiplying
  41. sectors/track by tracks/cylinder by cylinders didn't work out to the
  42. specified total number of sectors on the disks anyway!
  43.  
  44. Well, it turns out that the situation is more complex than that...
  45.  
  46. The BSD Fast File System uses certain heuristics to allocate disk
  47. blocks within a partition.  Some of these are supposed to increase
  48. data security (against accidental loss), some to make file access more
  49. efficient.  For instance:
  50.  
  51. - Groups of inodes are allocated in each cylinder group in the
  52.   partition, and attempts are made to keep file data blocks near the
  53.   inodes describing them.  (Efficiency)
  54.  
  55. - Each cylinder group has a redundant copy of the superblock, which is
  56.   staggered by one track per cylinder group, to keep them on different
  57.   platters.  Inodes follow the superblock copy, to stagger those as
  58.   well.  (Security)
  59.  
  60. - File data blocks are allocated for rotational contiguity.  The
  61.   optimal block is not necessarily the one following the previous one;
  62.   if the system is not fast enough to schedule a new disk transfer in
  63.   time, a "rotationally later" block is selected.  If the optimal block
  64.   on the disk is already taken, the same block (or one as closely
  65.   following it as possible) on another track in the same cylinder is
  66.   attempted allocated instead, and so on.  (Efficiency)
  67.  
  68. There's more to it than this, of course, but note the assumptions
  69. being made here: The file system needs to know the correct disk
  70. geometry; cylinders, heads, and sectors per track.  The product of the
  71. last two of these must be the correct number of sectors per cylinder.
  72. It must also know the rotational speed of the disk, and it assumes
  73. that sectors within tracks are numbered in parallell, so that sector 0
  74. of each track in a cylinder passes the read/write head at the same
  75. time.
  76.  
  77. Guess what?  This doesn't hold true for SCSI disks!  These disks tend
  78. to do quite a bit of optimization of their own, behind the file
  79. system's back...  For instance:
  80.  
  81. - Tracks are usually rotationally staggered, to optimize the time to
  82.   sequentially get from the last sector of one track to the first sector
  83.   of the (logically) next one.  This counteracts the rotational delay
  84.   optimization in the file system.
  85.  
  86. - Spare sectors (for bad block replacement) are usually allocated on
  87.   a per-cylinder basis.  This is a good strategy for optimal disk
  88.   utilization and effective relocation, but it breaks the file
  89.   system's calculation of where cylinder boundaries are, since heads
  90.   multiplied by sectors per track does not equal (usable) sectors
  91.   per cylinder.
  92.  
  93. - Large SCSI disks tend to use zone bit recording, which means that
  94.   there are more sectors per track on the outer tracks than on the
  95.   inner ones.  Then they lie to the file system about geometry, giving
  96.   it something that works out close to the correct size of the disk.
  97.   Again, this ruins the file system's attempt to intelligently use
  98.   cylinder boundary information, which is guaranteed to be wrong.
  99.  
  100. So, what do you do if you want optimal performance from a SCSI disk?
  101. Well, as long as the disk does not do zone bit recording, there may
  102. be hope.  SCSI disks can be reparameterized and reformatted.  However,
  103. the number of parameters that you can change varies from disk to disk.
  104. (See the man page entry on 'rzdisk' for more information on how to
  105. examine and change these parameters.)
  106.  
  107. - If you can set track skew and cylinder skew parameters to zero, thus
  108.   reorienting the geometry of the disk to what the file system expects,
  109.   you can get the timing calculations to work.
  110.  
  111. - If you can make the disk allocate spare sectors on a per-track basis,
  112.   you can make the cylinder boundary calculations work right, by
  113.   using, say, one spare per track, and telling the file system that
  114.   the disk has one less sector per track than it really does.  (The
  115.   file system doesn't know about spares; it counts usable sectors.)
  116.   This means that tracks with more than one fault will be reallocated
  117.   to the spare cylinders you reserve at the end of the disk, but that
  118.   can't very well be helped.
  119.  
  120. - If spare sectors can only be allocated on a per-cylinder basis, a
  121.   hack is still possible!  According to Stefan Esser, you can specify
  122.   (through /etc/disktab and/or mkfs) that the disk has only one head,
  123.   with a rather large number of sectors per track (the number of
  124.   actually usable sectors per real cylinder).  He notes, however, that
  125.   a patch to the ufs_alloc() function in the file system is necessary,
  126.   because, as shipped from DEC, it can't handle this large number of
  127.   sectors per track.
  128.  
  129. It would seem, then, that the correct choice, when you need high disk
  130. throughput, is to get a disk that does not do zone bit recording, and
  131. that can be reparameterized to use a non-staggered layout with a spare
  132. sector per track.  This will normally mean smaller disks, and thus an
  133. increased number of drives to achieve the same storage space -- which
  134. isn't too bad anyway if you're really into speed; e.g. two optimized
  135. drives on each of two SCSI controllers should be much better than two
  136. non-optimized, bigger drives on one controller.
  137.  
  138. I expect, though, that future versions of the BSD Fast File System
  139. will have knowledge of SCSI disks, and how to use them effectively.
  140. I understand that Sun has already made such changes, resulting in
  141. noticeable improvements.
  142.  
  143. -tih
  144. --
  145. Tom Ivar Helbekkmo, NHH, Bergen, Norway.  Telephone: +47-5-959205
  146. Postmaster for domain nhh.no.   Internet mail: tih@barsoom.nhh.no
  147.