  Root RAID HOWTO cookbook
  Michael A. Robinton, michael@bzs.org
  <mailto:michael@bzs.org>
  v1.08, April 02, 1998
  P, fjwr@mtj.biglobe.ne.jp
  <mailto:fjwr@mtj.biglobe.ne.jp>
  3 May 1998

  ̕ł RAID ō\t@CVXe[gfBNgƂ
  }Eg邽߂̕@ƁCLinux  initrd gđ΂ɂȂ fallback 
  VXe邽߂̕@qׂ܂DRAID1  RAID5  md0 foCX
  gp銮SȎ菇܂D菇̊eXebvƈꏏɂ̖ړI
  ܂D̔ł RAID1  RAID5 ̐ݒ́C3̍sŐݒ肳
  ``/etc/raidboot.conf'' t@Cɍ킹Đݒ肵ʓI linuxrc ini-
  trd t@C܂ł܂D
  ______________________________________________________________________

  ڎ

  1. ͂߂
     1.1 {̍ŐVł̓
     1.2 oO
     1.3 ӎ
     1.4 쌠\

  2. Ƃn߂OɕKvȎ
     2.1 KvȃpbP[W
     2.2 ̗ގ̎n
     2.3 Гǂł
     2.4 RAID ֘Ȁ

  3. [gfBNg RAID ɂ@̊T
  4. RAID [gƂă}Eg邽߂ initrd ̉
     4.1 ZLeBɊւ钍ӎ
     4.2 J[l RAID c[̍\z
     4.3 initrd ɂ镜yыNt@CVXe̍\z
     4.4 XebvEoCEXebv̎菇
     4.5 fBXgr[ṼCXg[ (Slackware ̏ꍇ̂)
     4.6 Linux pthreads ̃CXg[
     4.7 RAID c[̃CXg[
     4.8 Vt@CVXe̕svȃfBNgƃt@C̍폜
     4.9 /dev/mdx ̍쐬
     4.10 initrd ̂߂̗̃t@CVXe쐬
        4.10.1 N/p initrd t@CVXe̍쐬
        4.10.2 VXȅC
     4.11 `initrd'  RAID foCXN - linuxrc
     4.12 Vbg_Ep rc XNvg̏C
     4.13 Configuring RAIDBOOT - raidboot.conf
     4.14 CRAID VXe 'loadlin  LILO' ̃J[lp[^w

  5. M҂̎dp RAID VXe̐ݒ
     5.1 VXe̎dl }U[{[hĂ2̃VXe̐ݒȉɎ܂D
     5.2 n[hfBXÑp[eBV

  6. RAID t@CVXe̍\z
     6.1 /etc/raid5.conf
     6.2 /etc/raid1.conf
     6.3 dp RAID t@CVXe\z邽߂̋̓I菇

  7. Ōɒӂ_
  8. t^ A. Bohumil Chalupa ɂ md0 ̃Vbg_E
  9. Vbg_EXNvg̗
     9.1 Slackware - /etc/rc.d/rc.6
     9.2 Debian bo - /etc/init.d/halt and /etc/init.d/reboot
        9.2.1 /etc/init.d/halt
        9.2.2 /etc/init.d/reboot

  10. t^ C: ̑̐ݒt@C
     10.1 linuxrc ANAME CDATA linuxrc file(REF)REF
     10.2 loadlin -- linux.bat file - boot.par ANAME CDATA linux.bat file - boot.par(REF)REF
     10.3 linuxthreads Makefile.diff ANAME CDATA linuxthreads Makefile.diff(REF)REF
     10.4 raid1.conf ANAME CDATA raid1.conf(REF)REF
     10.5 raid5.conf ANAME CDATA raid5.conf(REF)REF
     10.6 raidboot.conf ANAME CDATA raidboot.conf(REF)REF
     10.7 rc.raidown ANAME CDATA rc.raidown(REF)REF

  11. t^ D: Â linuxrc ƃVbg_EXNvg
     11.1 Ât@C - linuxurc
     11.2 Ât@C - Vbg_EXNvg

  12. t^ E: Gadi  RAID ~ɊւLinux J[lpb`
  13. t^ F: rc.raidown
  14. t^ G: linuxrc ̓쌴

  ______________________________________________________________________

  1.  ͂߂

  ǎ҂͐FXȃ^Cv RAID ̎Ƃ̗_⌇_悭킩Ă
  ̂Ɖ肵܂D{̓`[gAł͂ȂCLinux VXe
  RAID [gɃ}Eg@̎菇̂łDLinux  RAID
  ɂĒm邽߂ɕKvȏ͑SĕŒڎCQlƂĎ
  Ă܂Dł玄Ɏ̃[𑗂̂͂悭ׂ
  sĂD

  1.1.  {̍ŐVł̓

  Root-RAID-HOWTO

  LaTeX (DVI  PostScript ܂)CeLXgCHTML ̊etH[}bg
  œł܂D

       sunsite.unc.edu/mdw/HOWTO/ <http://sun-
       site.unc.edu/mdw/HOWTO/>

  SGML  HTML `œł܂D

       ftp.bizsystems.com/pub/raid/ <ftp://ftp.bizsys-
       tems.com/pub/raid/>

  1.2.  oO

  ̕Ă鎞_ŁC[gɃ}Eg RAID foCX~
  ͊Sɂ͉Ă܂DEd Welbon 񂪒ĂCBohumil
  Chalupa 񂪎@͂̕Ɋ܂܂Ă܂D RAID1
   RAID5 foCX̏ꍇɁCu[g̒ ckraid R}hKvł
  ȂȂƂ̂łD̉@sȂƁCVXeċN
  x md foCXɑ΂ ckraid KvƂȂ܂DꂾƑ傫ȃAC
  ̏ꍇɂ́CVXe̐\啝ɒቺĂ܂܂DM҂ Pentium
  166,  128M ̃VXeœ삵Ă 6G  RAID1 foCXł́C
  ċN̓x ckraid 30ȏĂ܂܂ :-( ]x 20MB/
  b SCSI A_v^ɐڑĂ 15MKoCg RAID5 AC̏ꍇ1
  Ԉȏォ܂D

  @Ƃ̂́CVbg_EɃAC̏Ԃۂ̃u[gfoC
  XɕۑāCɒuĂŏɃVXe\z̎QƃXe[^
  XƔr̂łDXe[^XċN̂ƂɈvĂ΃AC
  X[p[ubÑ͎u[gɍč\zCłȂ΃Iy[^
  Xe[^XG[ʒmCSĂ RAID c[gp\ȕVXe
  c܂D

  X[p[ubNč\z邱ƂŁCSẴhCuOK̈t
  ܂Cmdstop sɃAC̓d؂ꂽƂVXeɖ
  邱ƂN܂D͑SẴhCũXe[^XVbg_E
  OKłꍇ삵܂Dُ킪hCuŃAC
  Ăꍇɂ́Cmd foCXăX^[gOɈُȃhCu
  菜KvCłȂ΃f[^Ă܂Ƃ܂D

  RAID0 ̏ꍇ̓Vbg_EO mdstop sKv̂ŁCL̂
  Ƃ͂Ă͂܂܂D

  ̖ɑ΂čŏIIɒĂꂽ́Cinitrd Ɏ finalrd ƁCfo
  CX[hI[̎̓Vbg_E clean tO
  mdrootstop𓱓邱ƂłD̕@Ƃ͂邱Ƃł傤D

  ƂɂĈƂ͖邱Ƃ͂łĂ܂D̖
  ܂ꂽ為Ўɂm点D

  1.3.  ӎ

  ȉ̕X̕⃁[̂ł̕܂DACfBA
  قƂǂ͑̐l̂̂Ă̂ŁC͂ COOKBOOǨ`
  ɂ܂Ƃ߁CɎg悤ɂłD

  o  Linas Vepstas  <mailto:linas@linas.org>
       RAID HOWTO łقƂǂ̂Ƃ׋Ă܂D

  o  Gadi Oxman  <mailto:gadio@netvision.net.il>
      ɂ́uflv̂ȂɓĂ܂D

  o  Ed Welbon  <mailto:welbon@bga.com>
      ̑f炵 initrd.md pbP[Wł̕Ƃ
     Ȃ܂D

  o  Bohumil Chalupa  <mailto:bochal@apollo.karlov.mff.cuni.cz>  
     ċŃuvĂŁC d̊
     RAID [gɃ}EgĎg悤ɂȂ܂D

  o  ̑ɐFXȓ_̍ƂĂXD

  1.4.  쌠\

  This document is GNU copyleft by Michael Robinton michael@bzs.org
  <mailto:michael@bzs.org>.

  Permission to use, copy, distribute this document for any purpose is
  hereby granted, provided that the author's / editor's name and this
  notice appear in all copies and/or supporting documents; and that an
  unmodified version of this document is made freely available.  This
  document is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY, either expressed or implied.  While every effort
  has been taken to ensure the accuracy of the information documented
  herein, the author / editor / maintainer assumes NO RESPONSIBILITY for
  any errors, or for any damages, direct or consequential, as a result
  of the use of the information documented herein.

  2.  Ƃn߂OɕKvȎ

  RAID ݒ肵C^p邽߂ɕKvȃpbP[WCقƂǂ̋^ɓ
  Ă镶ȉɎ܂DȒPɂłǂł炱̎ɂ͖
  ʂĂD

  2.1.  KvȃpbP[W

  ܂͈ȉ̃pbP[W̍ŐṼo[W肷Kv܂D

  o  RAID, initrd, /dev/loopx T|[gĂ Linux J[l

       M҂ linux-2.0.33 <ftp://sunsite.unc.edu/pub/Linux/ker-
       nel/>  sunsite 肵܂D

  o  raid145-971022-2.0.31
     <ftp://ftp.kernel.org/pub/linux/daemons/raid/> RAID1/4/5 ̃T|[g
     ǉpb`łD
  o  raidtools-pre3-0.42 <ftp://ftp.kernel.org/pub/linux/daemons/raid/>
     RAID ̃foCX쐬CǗ邽߂̃c[(ƕ)łD

  o  ``Gadi  RAID ~pb`'' t^ E Ɋ܂߂Ă܂D

  o  linuxthreads-0.71
     <ftp://ftp.inria.fr/INRIA/Projects/cristal/Xavier.Leroy> Xbh
     pbP[WKvłDEFuuEU͎gȂ̂ FTP Ă
     D

  o  CXg[ł Linux ̃fBXgr[V

       M҂ Slackware-3.4 <ftp://ftp.cdrom.com/pub/linux> g
       Ă܂D

  Kvł͂ȂǁC𗧂

  o  raidboot-0.01.tar.gz <ftp://ftp.bizsystems.com/pub/raid/> \ߍ쐬
     Ă RAID /NVXe

  {ɂ̓IȎ菇͏L̃pbP[WOɂĂ܂Dpb
  P[W̃o[WXVĂCƈقȂ Linux ̃fBXg
  r[VgĂꍇɂ́C̓IȎ菇قȂ邩܂D

  pb`c[̓o[W 2.1 ̃J[lł͈قȂꍇ܂D
  ŐV̕ȉŊmFĂD

       ftp.kernel.org/pub/linux/daemons/raid/ <ftp://ftp.ker-
       nel.org/pub/linux/daemons/raid/>

  2.2.  ̗ގ̎n

  ̓W[͎gȂŁCKvȂ̂͑SăJ[lɑgݍނƂɂ
  ܂D̃J[lC[W̑傫́Ck 300k ƏłD

  N\ RAID foCXʂ̕@ƂāCEd Welbon 
  <mailto:welbon@bga.com>  initrd.md.tar.gz ĂD̕
  @ł̓W[gĂ܂DW[gĂƂĂJ[l
  肽ꍇɂ́C̃pbP[WɊ܂܂ȒPȃXNvg΁C
  ǂ΂悢킩܂D

       http://www.realtime.net/~welbon/initrd.md.tar.gz
       <http://www.realtime.net/~welbon/initrd.md.tar.gz>

  2.3.  Гǂł

  ܂

       /usr/src/linux/Documentation/initrd.txt

  ͓ǂłD

  ꂩ raidtools pbP[Wɕt̕}jAǂł
  D man mdadd  QuickStart.RAID ɂ͖ڂʂĂD

  ȉ̂̂ɂڂʂĂƗǂł傤D

  o  BootPrompt-HOWTO <http://sunsite.unc.edu/mdw/HOWTO/BootPrompt-
     HOWTO.html>

  o  man lilo

  o  man lilo.conf

  2.4.  RAID ֘Ȁ

  o  sunsite.unc.edu/mdw/HOWTO/mini/Software-RAID
     <http://sunsite.unc.edu/mdw/HOWTO/mini/Software-RAID>

  o  www.ssc.com/lg/issue17/raid.html
     <http://www.ssc.com/lg/issue17/raid.html>

  o  linas.org/linux/raid.html <http://linas.org/linux/raid.html>

  o  ftp.kernel.org/pub/linux/daemons/raid/
     <ftp://ftp.kernel.org/pub/linux/daemons/raid/>

  o  www.realtime.net/~welbon/initrd.md.tar.gz
     <http://www.realtime.net/~welbon/initrd.md.tar.gz>

  o  luthien.nuclecu.unam.mx/~miguel/raid/
     <http://luthien.nuclecu.unam.mx/~miguel/raid/>

     ֌W郁[OXgȉɗ񋓂܂D

  o  majordomo@nuclecu.unam.mx <mailto:majordomo@nuclecu.unam.mx> 
     subscribe raiddev̓ẽ[𑗂ΎQł܂D

     e raiddev@nuclecu.unam.mx <mailto:raiddev@nuclecu.unam.mx> 
     [𑗂܂D

  o  majordomo@vger.rutgers.edu <mailto:majordomo@vger.rutgers.edu>
     subscribe linux-raid̓ẽ[𑗂ΎQł܂D

     e linux-raid@vger.rutgers.edu <mailto:linux-
     raid@vger.rutgers.edu> փ[𑗂܂D (ꂪłȃ[
     OXĝ悤ł)

  3.  [gfBNg RAID ɂ@̊T

  VXeC\zCfobOȂꍇ́C
  Slackware-3.4 ɊÂčʓIȃVXeȉœ肵Ă
  D

       ftp.bizsystems.com/pub/raid/raidboot-0.01.tar.gz
       <ftp://ftp.bizsystems.com/pub/raid/>

  āC̎菇s܂D

  o  gpfBXÑT|[ggݍ݁CRAID LɂJ[l\
     z܂

  o  RAID ACݒC}Egł邩eXg܂

  o  RAID VXe OS CXg[܂

  o  [gfoCXƂ /dev/md0 QƂ悤 fstab ̓eC
     ܂DNɕKvȃp[eBV fstab Ɋ܂܂Ă邱ƂmF
     ܂D

  o  Modify your shutdown halt and reboot script(s) (mine is
     /etc/rc.d/rc.6) as shown in ``Modifying the rc-scripts for
     SHUTDOWN'' ̋LqɂāC}V̒~yэċÑXNvg(
     M҂̃VXeł /etc/rc.d/rc.6 ł)C܂D

  o  ȉ̎菇Ɏ悤ɁCt@CƗpVXeCVXe
     ƐV RAID VXe̗ɃRs[܂D

             cd /root/raidboot
             mkdir mnt
             gzip -d rescue.clean
             losetup /dev/loop0  rescue.clean
             mount /dev/loop0    mnt

     ̂悤Ƀt@CRs[܂D

             cp -p /etc/*         mnt/etc
             cp -p /etc/rc.d/*    mnt/etc/rc.d
                     {or as appropriate for your system}
             cp -a /lib/modules/* mnt/lib/modules

  Linux ̃fBXgr[VɂẮC[gt@CVXe
  ro/rw Xe[^X𒲂ׂ܂Dinitrd VXe rc NXNvg
  ́C𒲂ׂ镔菜Kv܂D``VXȅC''
  ̏͂̎菇QƂĂD

  devmd0/ [gfoCXfstab ɂȂ悤 fstab C܂DNɕK
  vȃp[eBV fstab Ɋ܂܂Ă邱ƂmF܂傤D

  RAID NݒLq /etc/raidboot.conf 쐬܂D
  t@C̍ŏ3sɂ̓RgĂ͂܂Dȍ~ȂΖ
  肠܂D

  raidboot.conf

          /dev/sda1 /dev/sda2
          raidboot
          raid5.conf
  # comments may only be placed 'after' the three
  # configuration lines.
  #
  # This is 'raidboot.conf'
  #
  # line one, the partition(s) containing the 'initrd' raid-rescue system
  #       It is not necessary to boot from these partitions, however,
  #       since the rescue system will not fit on floppy, it is necessary
  #       to know which partitions are to be used to load the rescue system
  #
  # line two, the path to the raidboot config information
  #       Where the shutdown status, etc... is located at boot time
  #       It does NOT include the mount point information, only 'path'
  #       /mntpoint/'path'
  #
  # line -3-, name of the raid configuration file
  #       Current raid configuration file i.e. raid1.conf, raid5.conf

  ͂̍Ƃs΁CRAID VXe̋Nł܂D

  t^ F ŐC``rc.raidown'' t@C # 쐬C𕜋C
  ƁCRAID ̊eVXe /etc/rc.d fBNg # ɃRs[܂D
  VXeA}EgCk܂D

          umount mnt
          losetup -d /dev/loop0
          mv rescue.clean rescue
          gzip rescue

  t@C RAID Np[eBVɃRs[܂D

          cp rescue.gz /mnt_point(1)/raidboot
          cp rescue.gz /mnt_point(2)/raidboot

  RAID ACLɂ܂D

          mdadd -ar

  RAID Np[eBV  QƃXe[^Xۑ܂D

          cat /proc/mdstat | grep md0 > /mnt_point(1)/raidboot/raidgood.ref
          cat /proc/mdstat | grep md0 > /mnt_point(1)/raidboot/raidgood.ref

  Ō ``N̐ݒp[^'' ̐ɏ]ċNvOݒ
  CRAID AC̃VXeN܂D

  4.  RAID [gƂă}Eg邽߂ initrd  ̉

   RAID ̕c[(rescue tools) ܂ `initrd' RAMfBXN
  邽߂̎葱łD

  {ł͓ RAID1  RAID5 ̎ɂĐs܂D

  4.1.  ZLeBɊւ钍ӎ

  p̃t@CVXe̓X^hAŎgpł܂DRAID AC
  }EgɎsꍇCVXe}Egē삵܂Dł
  ZLeBɂ͏\ӂĂI

  4.2.  J[l RAID c[̍\z

  ŏ̍Ƃ́Cpb`𓖂ĂăJ[lč\z邱Ƃ RAID c[
  Ɋ邱ƂłDt^ E  ``Gadi  RAID ~pb`'' mFC
  J[lɊ܂߂ĂDݒsĂ RAID foCX}EgCe
  Xg܂DڍׂȎ菇 raidtools pbP[WɊ܂܂Ă܂C{
  łŏqׂ܂D

  4.3.  initrd  ɂ镜yыNt@CVXe̍\z

  ͕/Np̃t@CVXeƎdp̃}Ṽt@CVXe
  \zۂ Slackware-3.4 fBXgr[Vg܂Dł
  Cǂ Linux fBXgr[VłȂƎv܂DقȂ
  fBXgr[Vgꍇɂ́C菇̂ Slackware ɓ
  mFCKvɉďCĂD

  M҂ loadlin găJ[lC[WRAMfBXN DOS p[eB
  VNĂ܂ĆCP DOS ̐ݒ\tgEFAg
  foCXgĂ邩łDLILO ł܂삵܂CRAID/
  Nt@C lilo R[h܂ޏ Linux p[eBVg
  pł܂D

  M҂͍ŏ Slackware  `setup' XNvggčŏRAMfBX
  NVXeCɂRAMfBXN̑fSlackware 
  `linuxthreads' pbP[W `raidtools' ㏑CXg[邱Ƃ
  ܂D͎dp̃}V\zƂɂS葱p܂
  DłCVXeƎdpVXe͂قړ\ɂȂĂ
  D

  ̃CXg[ɂ`'VXeł܂(t@C̃Rs[
  Ă܂傤)D̃VXe

          /lib/modules/2.x.x......
          /etc .... with a modified fstab, mdtab, raidX.conf, raidboot.conf
          /etc/rc.d
          /dev/md*

  ݎgĂVXe㏑Rs[C݂邢͂ꂩ瓮삳
  悤ƂĂVXeɍ킹ăJX^}CY܂D

  ɂCN/VXeݓ삵Ă RAID foCX[g
  Ƀ}EgVXeƓɂł܂DCũo[W͏
  ŐVɂł܂CVXeɂȂ܂D

  4.4.  XebvEoCEXebv̎菇

  [U root ̃z[fBNg(/root)ňȉ̃R}hs܂:

          cd /root
          mkdir raidboot
          cd raidboot

  }Eg|Cg쐬܂D

          mkdir mnt
          mkdir mnt2

  t@CVXeCXg[̂ɏ\ȑ傫̃t@C
  D͍ŏIIȕt@CVXe肸Ƒ傫Ȃ܂D16K
  oCgł͏\ł͂Ȃ̂ŁC24KoCggƂɂ܂D

          dd if=/dev/zero of=build bs=1024k count=24

  t@C loop foCXƂCext2 t@CVXẽt@C
  쐬܂D

          losetup /dev/loop0 build
          mke2fs -v -m0 -L initrd /dev/loop0
          mount /dev/loop0 mnt

  4.5.  fBXgr[ṼCXg[ (Slackware ̏ꍇ̂)

  Slackware ɂʗpȂbȂ̂ŁCSlackware ȊÕfBXgr[
  Vgꍇɂ``̏͂ɐi''D

  ݂͋̃t@CVXeă}EgĂԂłD
  "setup"s܂D

          /root/raidboot/mnt

  w肵܂D`source'ɂ͒ʏ̃CXg[KXw肵܂Dpb
  P[WI͎RɍsĂ܂܂񂪁C`configure' ͍sȂł
  D

  vvg̃[hƂĂ `EXPERT' I܂D

  ̓VXe̍ŏ\ `A', `AP', `N' ɉCgĂăTCY
  GfB^(vi, jed, joe)I܂D

  lqqqqqqqq SELECTING PACKAGES FROM SERIES A (BASE LINUX SYSTEM) qqqqqqqqk
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x   [X] aaa_base  Basic filesystem, shell, and utils - REQUIRED    x x
  x x   [X] bash      GNU bash-1.14.7 shell - REQUIRED                 x x
  x x   [X] devs      Device files found in /dev - REQUIRED            x x
  x x   [X] etc       System config files & utilities - REQUIRED       x x
  x x   [X] shadow    Shadow password suite - REQUIRED                 x x
  x x   [ ] ide       Linux 2.0.30 no SCSI (YOU NEED 1 KERNEL)         x x
  x x   [ ] scsi      Linux 2.0.30 with SCSI (YOU NEED 1 KERNEL)       x x
  x x   [ ] modules   Modular Linux device drivers                     x x
  x x   [ ] scsimods  Loadable SCSI device drivers                     x x
  x x   [X] hdsetup   Slackware setup scripts - REQUIRED               x x
  x x   [ ] lilo      Boots Linux (not UMSDOS), DOS, OS/2, etc.        x x
  x x   [ ] bsdlpr    BSD lpr - printer spooling system                x x
  x x   [ ] loadlin   Boots Linux (UMSDOS too!) from MS-DOS            x x
  x x   [ ] pnp       Plug'n'Play configuration tool                   x x
  x x   [ ] umsprogs  Utilities needed to use the UMSDOS filesystem    x x
  x x   [X] sysvinit  System V-like INIT programs - REQUIRED           x x
  x x   [X] bin       GNU fileutils 3.12, elvis, etc. - REQUIRED       x x
  x x   [X] ldso      Dynamic linker/loader - REQUIRED                 x x
  x x   [ ] ibcs2     Runs SCO/SysVr4 binaries                         x x
  x x   [X] less      A text pager utility - REQUIRED                  x x
  x x   [ ] pcmcia    PCMCIA card services support                     x x
  x x   [ ] getty     Getty_ps 2.0.7e - OPTIONAL                       x x
  x x   [X] gzip      The GNU zip compression - REQUIRED               x x
  x x   [X] ps        Displays process info - REQUIRED                 x x
  x x   [X] aoutlibs  a.out shared libs - RECOMMENDED                  x x
  x x   [X] elflibs   The ELF shared C libraries - REQUIRED            x x
  x x   [X] util      Util-linux utilities - REQUIRED                  x x
  x x   [ ] minicom   Serial transfer and modem comm package           x x
  x x   [ ] cpio      The GNU cpio backup/archiving utility            x x
  x x   [X] e2fsbn    Utilities for the ext2 file system               x x
  x x   [X] find      GNU findutils 4.1                                x x
  x x   [X] grep      GNU grep 2.0                                     x x
  x x   [ ] kbd       Change keyboard mappings                         x x
  x x   [X] gpm       Cut and paste text with your mouse               x x
  x x   [X] sh_utils  GNU sh-utils 1.16 - REQUIRED                     x x
  x x   [X] sysklogd  Logs system and kernel messages                  x x
  x x   [X] tar       GNU tar 1.12 - REQUIRED                          x x
  x x   [ ] tcsh      Extended C shell version 6.07                    x x
  x x   [X] txtutils  GNU textutils-1.22 - REQUIRED                    x x
  x x   [ ] zoneinfo  Configures your time zone                        x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x

  `AP' V[Y͎̍DȃGfB^ `JOE' ƃRpNgŕ֗ȃt@C
  c[ł `MC' I܂D͕Kvɉă[eB
  eBIĂD

  lqqqqqqqqq SELECTING PACKAGES FROM SERIES AP (APPLICATIONS) qqqqqqqqqk
  x x     [ ] ispell    The International version of ispell          x x
  x x     [ ] jove      Jonathan's Own Version of Emacs text editor  x x
  x x     [ ] manpgs    More man pages (online documentation)        x x
  x x     [ ] diff      GNU diffutils                                x x
  x x     [ ] sudo      Allow special users limited root access      x x
  x x     [ ] ghostscr  GNU Ghostscript version 3.33                 x x
  x x     [ ] gsfonts1  Ghostscript fonts (part one)                 x x
  x x     [ ] gsfonts2  Ghostscript fonts (part two)                 x x
  x x     [ ] gsfonts3  Ghostscript fonts (part three)               x x
  x x     [ ] jed       JED programmer's editor                      x x
  x x     [X] joe       joe text editor, version 2.8                 x x
  x x     [ ] jpeg      JPEG image compression utilities             x x
  x x     [ ] bc        GNU bc - arbitrary precision math language   x x
  x x     [ ] workbone  a text-based audio CD player                 x x
  x x     [X] mc        The Midnight Commander file manager          x x
  x x     [ ] mt_st     mt ported from BSD - controls tape drive     x x
  x x     [ ] groff     GNU troff document formatting system         x x
  x x     [ ] quota     User disk quota utilities                    x x
  x x     [ ] sc        The 'sc' spreadsheet                         x x
  x x     [ ] texinfo   GNU texinfo documentation system             x x
  x x     [ ] vim       Improved vi clone                            x x
  x x     [ ] ash       A small /bin/sh type shell - 62K             x x
  x x     [ ] zsh       Zsh - a custom *nix shell                    x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x

  `N' pbP[W TCP/IP ܂D͕KKvł͂
  ܂񂪁Cɕ֗łC[g RAID AC}EgĂ
  ԂŕXV̍ƂsۂɃlbg[NɃANZXł悤ɂ
  ܂DTCP/IP ɂ `A' Ɋ܂܂AvP[V̂gp
  `biff' ܂ł܂D`N' CXg[ȂƂĂCbiff pb
  P[W͓ꂽȂƎv܂D

  lqqqq SELECTING PACKAGES FROM SERIES N (NETWORK/NEWS/MAIL/UUCP) qqqqqk
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x    [ ] apache    Apache WWW (HTTP) server                      x x
  x x    [ ] procmail  Mail delivery/filtering utility               x x
  x x    [ ] dip       Handles SLIP/CSLIP connections                x x
  x x    [ ] ppp       Point-to-point protocol                       x x
  x x    [ ] mailx     The mailx mailer                              x x
  x x    [X] tcpip     TCP/IP networking programs                    x x
  x x    [ ] bind      Berkeley Internet Name Domain server          x x
  x x    [ ] rdist     Remote file distribution utility              x x
  x x    [ ] lynx      Text-based World Wide Web browser             x x
  x x    [ ] uucp      Taylor UUCP 1.06.1 with HDB && Taylor configs x x
  x x    [ ] elm       Menu-driven user mail program                 x x
  x x    [ ] pine      Pine menu-driven mail program                 x x
  x x    [ ] sendmail  The sendmail mail transport agent             x x
  x x    [ ] metamail  Metamail multimedia mail extensions           x x
  x x    [ ] smailcfg  Extra configuration files for sendmail        x x
  x x    [ ] cnews     Spools and transmits Usenet news              x x
  x x    [ ] inn       InterNetNews news transport system            x x
  x x    [ ] tin       The 'tin' news reader (local or NNTP)         x x
  x x    [ ] trn       'trn' for /var/spool/news                     x x
  x x    [ ] trn-nntp  'trn' for NNTP (install 1 'trn' maximum)      x x
  x x    [ ] nn-spool  'nn' for /var/spool/news                      x x
  x x    [ ] nn-nntp   'nn' for NNTP (install 1 'nn' maximum)        x x
  x x    [ ] netpipes  Network pipe utilities                        x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x

  CXg[ICȊO̍ڂɂ͑S `no' Ɠ(SĂ̐
  荀ڂ `no' Ɠ)CXNvgI܂D

  4.6.  Linux pthreads  ̃CXg[

  `linuxthreads-0.71' CuCXg[Ȃ΂Ȃ܂D
  ł͎ƂɂCXg[ڂɁClinuxthreads
   Makefile ɑ΂鍷pb`܂D Makefile ۑĂ
  diff R}hŃpb`𓖂āC make s܂D

          cd /usr/src/linuxthreads-0.71
    patch
          make
          make install

  -------------------diff Makefile.old  Makefile.raid-----------------
  2a3,13
  > # If you are building "linuxthreads" for installation on a mount
  > # point which is not the "root" partition, redefine 'BUILDIR' to
  > # the mount point to use as the "root" directory
  > # You may wish to do this if you are building an 'initial ram disk'
  > # such as used with bootable root raid devices.
  > # REQUIRES ldconfig version 1.9.5 or better
  > # do ldconfig -v to check
  > #
  > BUILDIR=/root/raidboot/mnt
  > #BUILDIR=
  >
  81,82c92,93
  <       install pthread.h $(INCLUDEDIR)/pthread.h
  <       install semaphore.h $(INCLUDEDIR)/semaphore.h
  ---
  >       install pthread.h $(BUILDIR)$(INCLUDEDIR)/pthread.h
  >       install semaphore.h $(BUILDIR)$(INCLUDEDIR)/semaphore.h
  84c95
  <       test -f /usr/include/sched.h || install sched.h $(INCLUDEDIR)/sched.h
  ---
  >       test -f $(BUILDIR)/usr/include/sched.h || install sched.h $(BUILDIR)$(INCLUDEDIR)/sched.h
  86,89c97,103
  <       install $(LIB) $(LIBDIR)/$(LIB)
  <       install $(SHLIB) $(SHAREDLIBDIR)/$(SHLIB)
  <       rm -f $(LIBDIR)/$(SHLIB0)
  <       ln -s $(SHAREDLIBDIR)/$(SHLIB) $(LIBDIR)/$(SHLIB0)
  ---
  >       install $(LIB) $(BUILDIR)$(LIBDIR)/$(LIB)
  >       install $(SHLIB) $(BUILDIR)$(SHAREDLIBDIR)/$(SHLIB)
  >       rm -f $(BUILDIR)$(LIBDIR)/$(SHLIB0)
  >       ln -s $(SHAREDLIBDIR)/$(SHLIB) $(BUILDIR)$(LIBDIR)/$(SHLIB0)
  > ifneq ($(BUILDIR),)
  >       ldconfig -r ${BUILDIR} -n $(SHAREDLIBDIR)
  > else
  91c105,106
  <       cd man; $(MAKE) MANDIR=$(MANDIR) install
  ---
  > endif
  >       cd man; $(MAKE) MANDIR=$(BUILDIR)$(MANDIR) install

  4.7.  RAID c[̃CXg[

  CXg[̎̃Xebv́CRAID c[ raidtools-0.42 ̃CXg[
  łD

  RAMfBXÑt@C\zfBNg Makefile ɋ邽߂
  "configure" XNvgs܂D

    cd /usr/src/raidtools-0.42
    configure --sbindir=/root/raidboot/mnt/sbin --prefix=/root/raidboot/mnt/usr
    make
    make install

  Œӂׂ_܂DCXg[Ɏg Makefile ͐Ȃ
  ̂ŁC𒼂߂Ɏ̍Ƃs܂D͏̃[Xł͏C
  CăN͕KvȂ\łD

       CXg[G[̏C

  삷邽߂ɂ Makefile  `LINKS' Ŏw肳Ăt@C
  N폜C蒼Ȃ΂Ȃ܂D

          cd /root/raidboot/mnt/sbin
          ln -fs mdadd mdrun
          ln -fs mdadd mdstop

  4.8.  Vt@CVXe̕svȃfBNgƃt@C̍폜

  ȉ̃fBNgƃt@Ct@CVXe폜܂D (:
  Č݉ғ̃VXẽt@CȂ悤ɁD) ̃Xg
  ăt@CȂȒPłC̃Xgǂč
  lĂI

          cd /root/raidboot/mnt
          rm -r home/ftp/*
          rm -r lost+found
          rm -r usr/doc
          rm -r usr/info
          rm -r usr/local/man
          rm -r usr/man
          rm -r usr/openwin
          rm -r usr/share/locale
          rm -r usr/X*
          rm -r var/man
          rm -r var/log/packages
          rm -r var/log/setup
          rm -r var/log/disk_contents

  4.9.  /dev/md x  ̍쐬

  Ō̃Xebv́C݂̃t@CVXe畜t@CVXe
  /dev/md* foCXRs[邱ƂłD mknod łsƂ
  łł傤D

          cp -a /dev/md* /root/raidboot/mnt/dev

  4.10.  initrd  ̂߂̗̃t@CVXe쐬

  ŃJX^}CYłCėp\Ȃ܂ȃt@CVXeł
  ܂DxJX^}CYƁCfBXNɎgƂł邱̃t@
  CVXe͉Ă܂CC邽߂ɂRAIDc[KvƂȂ
  D͎̏͂Ő linuxrc t@Cǉ邱ƂɂāC
  u[gă[gɃ}Eg RAID foCXɎgƂł܂D

  initrd t@Ĉ߂ɏfoCXփVXeRs[܂D16K
  oCgΏ\ł傤D

  t@CVXeC}Eg܂D

          cd /root/raidboot
          dd if=/dev/zero of=bare.fs bs=1024k count=16

  t@C loop foCXƂC̃t@C ext2 t@CVXe\
  z܂D

          losetup /dev/loop1 bare.fs
          mke2fs -v -m0 -L initrd /dev/loop1
          mount /dev/loop1 mnt2

  `build't@CVXe`bare.fs'ɃRs[܂D

          cp -a mnt/* mnt2

  ̍XVeՂɂ邽߁CJX^}CY̑O `bare.fs' VXeۑ
  ܂D`build' t@CVXe͂Kv܂̂ŁCĂ\
  ܂D

          cd /root/raidboot
          umount mnt
          umount mnt2
          losetup -d /dev/loop0
          losetup -d /dev/loop1
          rm build
          cp bare.fs rescue
          gzip -9 bare.fs

  4.10.1.  N/p initrd  t@CVXe̍쐬

  ɁCƗp̃}VJ[lɓKVXeˑ̃t@CR
  s[邩C^[Qbg̃VXeɓK悤ɕt@CVXe
  t@CŏC邩܂D

          losetup /dev/loop0 rescue
          mount /dev/loop0 mnt

  etc fBNg *~ t@CCcore, Ot@CƂmF
  ܂D2̃R}h͂EH[jOo܂CĂ
  D

          cp -dp /etc/* mnt/etc
          cp -dp /etc/rc.d/* mnt/etc/rc.d

          mkdir  mnt/lib/modules
          cp -a  /lib/modules/2.x.x mnt/lib/modules <--- your current 2.x.x

  4.10.2.  VXȅC

  VXëȉ̃t@CC܂Dŋt@C̒ɂ
  Slackware L̂̂܂C̃fBXgr[Vł
  ̂͂łD

          cd mnt

  lbg[N֌WłȂ
          etc/fstab
          etc/mdtab       ̂܂܂ővł傤
  lbg[N֌W
          etc/hosts
          etc/resolv.conf
          etc/hosts.equiv         yъ֘At@C
          etc/rc.d/rc.inet1       IPAhXClbg}XNCQCgEFC̐ݒC܂
          etc/rc.d/rc.S           t@CVXẽXe[^X֌W̕Sč폜܂
                          # Test to see if the root partition is read-only
                  ̕
                          # remove /etc/mtab* so that mount will .....
                  ܂܂Ȃ܂ł폜܂D
                                   RAMfBXNǂݏ\Ń}E
                                  gƏo邤邳EH[jOo
                                  Ȃ悤ɂ܂D
          etc/rc.d/rc.xxxxx       KvȂΑ̃t@CD{Ōq܂
          root/.rhosts            ݂
          home/xxxx/xxxx          KvȂΑ̃t@C

      x:       ̍Ƃ passwd  shadow ̃t@C͕VXe
                  Rs[Ă܂܂I̓ZLeB̗RōD
                  ܂Ȃꍇł傤D

  Kvɉ /dev/disk }Eg邽߂̃fBNg܂D
  ̓VXeňӂɌ܂Ȃ΂Ȃ܂D̓VXeN
  邽߂̃}Eg|Cg(Np[eBVƋNp[eBṼob
  NAbv)ɂȂ܂DM҂̃VXe loadlin 𗘗p DOS N
  悤ɂȂĂ܂CLinux p[eBV LILO ł܂삵
  ܂DM҂̃VXeł͈ȉ̂悤ɂȂĂ܂D

          cd /root/raidboot/mnt           <-- initrd ̃[g
          mkdir dosa                      DOS p[eBṼ}Eg|Cg
          mkdir dosb                      DOS ̃~[̃}Eg|Cg

  t@CVXe͂ŏoオłI

  t@CVXẽt@C𒲂ׂ΁C܂̃t@C邱
  ƂƎv܂D̍Ƃ͕G邱ƂƁCقƂǂ RAID VX
  eɂ͏\ȃfBXNƃ邱ƂC͂sĂ͂܂
  Dt@CVXeƃX}[gɂ΁CłĂ
  I

  4.11.  `initrd'  RAID foCXN - linuxrc

  fBXN RAID foCXNɂ́C̃XNvgt@C

       linuxrc

  foCX̃[gɃRs[邾łD

   linuxrc t@C̓ɂĂ̘b ``t^ G, linuxrc ̓ɂ
  ''ŋc_܂D
  ƊȒPŗ₷() linuxrc  ``t^ D'' ɂ܂
  C͌Â linuxrc ƒ~XNvgłDȉ̕ linuxrcƂ
  čƃfBNgɃRs[Ă܂傤D

   -------------------- linuxrc ----------------------
  #!/bin/sh
  # ver 1.13 3-6-98
  #
  ################# BEGIN 'linuxrc' ##################
  #                DEFINE FUNCTIONS                  #
  ####################################################
  # Define 'Fault' function in the event something
  # goes wrong during the execution of 'linuxrc'
  #
  FaultExit () {
  # correct fstab to show '/dev/ram0' for rescue system
      /bin/cat /etc/fstab | {
      while read Line
      do
          if [ -z "$( echo ${Line} | /usr/bin/grep md0 )" ]; then
              echo ${Line}
          else
              echo "/dev/ram0 / ext2 defaults 1 1"
          fi
      done
      } > /etc/tmp.$$
      /bin/mv /etc/tmp.$$ /etc/fstab
  #       point root at /dev/ram0 (the rescue system)
          echo 0x100>/proc/sys/kernel/real-root-dev
          /bin/umount /proc
          exit
  }

  # Define 'Warning' procdure to print banner on boot terminal
  #
  Warning () {
      echo '*********************************'
      echo -e " $*"
      echo '*********************************'
  }

  # Define 'SplitKernelArg' to help extract 'Raid' related kernel arguments
  SplitKernelArg () { eval $1='$( IFS=,; echo $2)' }

  #Define 'SplitConfArgs' to help extract system configuration arguments
  SplitConfArgs () {
      RaidBootType=$1
      RaidBootDevice=$2
      RaidConfigPath=$3
  }
  ########################################################
  ################### MAIN linuxrc #######################
  ########################################################
  # mount the proc file system
  /bin/mount /proc

  # Get the boot partition and configuration location from command line
  CMDLINE=`/bin/cat /proc/cmdline`
  for Parameter in $CMDLINE; do
      Parameter=$( IFS='='; echo ${Parameter} )
      case $Parameter in
          Raid*) SplitKernelArg $Parameter;;
      esac
  done

  # check for 'required raid boot'
  if [ -z "${Raid_Conf}" ]; then
      Warning Kernel command line \'Raid_Conf\' missing
      FaultExit
  fi
  SplitConfArgs $Raid_Conf

  # tmp mount the boot partition
  /bin/mount -t ${RaidBootType} ${RaidBootDevice} /mnt

  # get etc files from primary raid system
  pushd /etc

  # this will un-tar into 'etc' (see rc.6)
  if [ ! -f /mnt/${RaidConfigPath}/raidboot.etc ]; then
  # bad news, this file should be here
      Warning required file \'raidboot.etc\' \
      missing from ${RaidBootDevice}/${RaidConfigPath} \\n \
      \\tUsing rescue system defaults
  else
      /bin/tar -xf /mnt/${RaidConfigPath}/raidboot.etc
  fi
  # get 'real' raidboot device for this boot
  # status path, and name of raidX.conf
  if [ ! -f /mnt/${RaidConfigPath}/raidboot.cfg ]; then
  # bad news, this file should be here
      Warning required file 'raidboot.cfg' \
      missing from ${RaidBootDevice}/${RaidConfigPath}\\n \
      \\tUsing rescue system defaults
  # Get the first raidX.conf file name in $RArg1
      RaidBootDevs=$RaidBootDevice
      RaidStatusPath=$RaidConfigPath
      for RaidConfigEtc in $( ls raid*.conf )
      do break; done
  else
      {
      read RaidBootDevs
      read RaidStatusPath
      read RaidConfigEtc
      } < /mnt/${RaidConfigPath}/raidboot.cfg

  fi
  popd
  /bin/umount /mnt

  # Set a flag in case the raid status file is not found
  #
  RAIDOWN="raidboot.ro not found"
  RAIDREF="raidgood.ref not found"
  echo "Reading md0 shutdown status."

  # search for raid shutdown status
  for Device in ${RaidBootDevs}
  do
  #   these filesystem types should be in 'fstab' since
  #   the partitions must be mounted for a clean raid shutdown
      /bin/mount ${Device} /mnt
      if [ -f /mnt/${RaidStatusPath}/raidboot.ro ]; then
          RAIDOWN=`/bin/cat /mnt/${RaidStatusPath}/raidboot.ro`
          RAIDREF=`/bin/cat /mnt/${RaidStatusPath}/raidgood.ref`
          /bin/umount /mnt
          break
      fi
      /bin/umount /mnt
  done
  # Test for a clean shutdown with array matching reference
  if [ "${RAIDOWN}" != "${RAIDREF}" ]; then
      Warning shutdown ERROR ${RAIDOWN}
      FaultExit
  fi

  # The raid array is clean, remove shutdown status files
  for Device in ${RaidBootDevs}
  do
      /bin/mount ${Device} /mnt
      /bin/rm -f /mnt/${RaidStatusPath}/raidboot.ro
      /bin/umount /mnt
  done

  # Write a clean superblock on all raid devices

  echo "write clean superblocks"
  /sbin/mkraid -f --only-superblock /etc/${RaidConfigEtc}

  # Activate raid array(s)
  if [ -z "$Raid_ALT" ]; then
      /sbin/mdadd -ar
  else
      /sbin/mdadd $Raid_ALT
  fi

  #  If there are errors - BAIL OUT and leave rescue running
  if [ $? -ne 0 ]; then
     Warning some RAID device has errors
     FaultExit
  fi

  # Everything is fine, let the kernel mount /dev/md0
  # tell the kernel to switch to /dev/md0 as the /root device
  # The 0x900 value is the device number calculated by:
  #  256*major_device_number + minor_device number
  echo "/dev/md0 mounted on root"
  echo 0x900>/proc/sys/kernel/real-root-dev
  # umount /proc to deallocate initrd device ram space
  /bin/umount /proc
  exit
  #------------------ end linuxrc ----------------------

  `linuxrc'  initrd ̋NfoCXɒǉ܂D

          cd /root/raidboot
          chmod 777 linuxrc
          cp -p linuxrc mnt

  4.12.  Vbg_Ep rc XNvg̏C

  CXg[̍Ō̎菇́CVbg_E md ̏Ԃ{̃[g
  foCXɕۑ邳悤 rc XNvgC邱ƂłD

  Slackware ̏ꍇ́Crc.0  rc.6 łDDebian `bo' ̏ꍇ́C
  `halt' y `reboot' ɂȂ܂D

  ȊÕfBXgr[VŎsꍇ́C̕ɒǉ
  邽߁C菇ƃTvt@CM҂Ƀ[őĂD

  RAID ~̖̂߂  Bohumil Chalupa ̕@
  X̂gĂ܂Dނ̎̕@ ``t^A''ŏqׂ܂D

  ̎dpVXeɂ md0 ȊO Linux p[eBV͎cĂȂ
  ŁCraidOK readonly ̃Xe[^Xۑ邽߂ɋNp[eBV
  gĂ܂DM҂̓Vbg_E md AC̃Xe[^X܂ދN
  p[eBVƂ̗̕փt@C݁Cmd foCX[
  hI[ōă}EgꂽƂL^邱Ƃɂ܂D̓n[h
  fBXN̂ǂꂩꂽƂ̏Q΍ƂȂ܂D

  Vbg_EXNvg͏CC``rc.raidown'' ƂOɂȂ
  D́CċNāC RAID foCX}Eg邽߂ɕKv
  ۑ邽߂̂̂łDefBXgr[Vp̃Vbg_E
  XNvg̗ ``t^ B''ŏЉ܂D

  RAID AC̃Vbg_ỄXe[^X𓾂邽߂ɁCSĂ case
  ()̌ŁCCۂ̃Vbg_E(kill, ԕۑ)
  t@CVXẽA}Eg̑O̕ɂ ``rc.raidown''Ă
  o܂D

  ############ Save raid boot and status info ##############
  #
    if [ -x /etc/rc.d/rc.raidown ]; then
      /etc/rc.d/rc.raidown
    fi
  ################## end raid boot #########################

  SẴt@CVXeA}Egꂽ([gt@CVXe
  A}Egu܂v)Cdf̃Xe[^X`FbN̑OɎ
  R}h܂D

  ################ for raid arrays #########################
  # Stop all known raid arrays (except root which won't stop)
    if [ -x /sbin/mdstop ]; then
      echo "Stopping raid"
      /sbin/mdstop -a
    fi
  ##########################################################

  ɂ胋[gȊȎSĂ RAID foCXSɒ~邱Ƃł
  ܂D[g̃Xe[^X raidstat.ro ɋL^C̋NɎQ
  ܂D

  rc t@CV RAID ACC܂  /root/raidboot/mnt Ƀ}Eg
  Ă镜t@CVXeC(}VȂ) ƗpVXe
  ꂼɃRs[܂D

  Kvɉĕt@CVXeetc/fstab̏CƁCt@CVX
  e mdtab ǂ̃`FbNs܂D

  āCfBXN DOS p[eBVɃRs[΁CRAID foCX
  [gt@CVXeƂăVXeN鏀͏IłD

          umount mnt
          losetup -d /dev/loop0
          gzip -9 rescue

  Np[eBV rescue.gz Rs[܂D

  cƂ́Cݒt@C raidboot.conf CVXeċNĐV
  t@CVXeeXg邱ƂłD

  4.13.  Configuring RAIDBOOT - raidboot.conf

  ݒ̌̃RǵCݒt@C̍ŏ3ŝꂼɂĂ̐
  łD 4 hCu SCSI RAID5 ACŁCNp[eBV
  sda1  sdb1 hCuɕĂꍇ̂̂łDۂɎgpꍇ
  ɂ́C̑Ƀt@CVXeɉp[^ݒ肵Ă
  D

    /dev/sda1 /dev/sdb1
    linux
    raid5.conf
  # Rg3̐ݒśuvɂ̂݋Lq邱Ƃł܂D
  #
  # ̃t@C 'raidboot.conf' łD
  #
  # 1s, 'initrd' RAID-VXêp[eBV
  #       ̃p[eBVNKv͂܂񂪁CVX
  #       e̓tbs[fBXNɂ͓Ȃł傤CVXe
  #       ǂ̃p[eBV烍[ĥ킩Ȃ΂Ȃ܂D
  #
  # 2s, raidboot ̐ݒւ̃pX
  #       Vbg_ẼXe[^XNɂǂɂ̂܂D
  #       ̓}Eg|Cg̏͊܂܂C'pX'
  #       /}Eg|Cg/'pX'݂̂܂݂܂D
  #
  # 3s, RAID ݒt@C̃t@C
  #       ݂ RAID ݒt@CłC܂ raid1.conf,
  #       raid5.conf ɂȂ܂D

  4.14.  CRAID VXe 'loadlin  LILO' ̃J[lp[^w
  

  RAID2̃J[lp[^܂Cw肷Kv
  ͑O҂݂̂łD

  o  Raid_Conf=msdos,/dev/sda1,raidboot

       ̃p[^ RAID NfoCXƐݒt@Cw肵
       Dtbs[fBXN̕VXeNꍇɂ́CJ[
       l̃R}hCC loadlin 邢 LILO ̋Nt@C
       ɂ̋Lq܂D

       : 't@CVXe̎,foCX,}Eg|Cg
       ݒt@Cւ̃pX'

  o  Raid_ALT=-r,-p5,/dev/md0,/dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3

       mdadd ̃p[^̑ɂȂ܂D璷łȂ RAID AC
       NƂɕKvƂȂ܂Dmdadd ̃R}hCp
       [^R}؂ŋLq܂Dj/璷AC
       KvƂȊOɂ́CRgAEg邩'k'
       w肵܂D

       Ȃ킿 Raid_ALT= w肵܂D

  ̃p[^ LILO  loadlin ̋Np[^t@CC
  loadlin ̃J[lR}hCŎwł܂DCR}hC
  Ŏw肷ꍇɂ́Cs̍ő̒(128)zȂ悤ɒӂĂ
  D
  LILO ŋNꍇɂ́CLILO ̐ݒt@Cւ̋Lq͎̂悤ɂȂ
  D

  append="Raid_Conf=msdos,/dev/sda1,raidboot"
  append="Raid_ALT=-r,-p5,/dev/md0,/dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3"

  ڂman lilo.confQƂĂD

  M҂ DOS ̐ݒ胆[eBeBKvƂn[hEFAĂ
  ŁCVXeɏ DOS p[eBVĂ܂DāC
  ɂȂfBXNɃ~[(Rs[) RAID5 VXeN̂
  loadlin gĂ܂D@ RAID1 VXełgĂ܂D
  ̗ł loadlin gĂ܂C LILO Ƃ悭Ă܂D

  Kvɉ loadlin ̋Np[^ҏWCeXgɃXbv
  fBXN Linux VXeNł悤ɁCDOS Ƀ[gVX
  eɂ͏GfB^Ă܂D

  DOS VXeɂ Linux ̂߂Ɉȉ̂悤ȃt@CĂ܂D

          c:\raidboot.bat
          c:\raidboot\loadlin.exe
          c:\raidboot\zimage
          c:\raidboot\rescue.gz
          c:\raidboot\raidboot.cfg
          c:\raidboot\raidboot.etc
          c:\raidboot\raidgood.ref
          c:\raidboot\raidstat.ro       (only at shutdown)

  ---------------------- linux.bat ---------------------------
  echo "Start the LOADLIN process:"
  c:\raidboot\loadlin @c:\raidboot\boot.par
  -------------------- end linux.bat -------------------------

  boot.par ̓e͈ȉłD

          # loadlin boot parameter file
          #
          # version 1.02 3-6-98

          # linux kernel image
          c:\linux\zimage

          # target root device
          root=/dev/md0
          #root=/dev/ram0
          #root=/dev/sdc5

          # mount root device as 'ro'
          ro

          # size of ram disk
          ramdisk_size=16384

          # initrd file name
          initrd=c:\raidboot\rescue.gz
          #noinitrd

          # memory ends here
          mem=131072k

          # points to raid boot device, configuration file
          # for floppy rescue boot, you may want to specify
          # this on the command line instead of here
          # format 'filesystem-type,device,path-to-config-frm_mntpnt'
          Raid_Conf=msdos,/dev/sda1,raidboot

          # Alternate mdadd parameters
          # necessary when boot with non-redundant raid
          # otherwise, COMMENT OUT OR SPECIFY 'NULL'
          #Raid_ALT=-r,-p5,/dev/md0,/dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3

          # ethernet devices
          ether=10,0x300,eth0

  ***** >> !! VXe̋NƁCRAID foCX̃}Eg̏ꍇ
              ́Cloadlin ̃p[^

                  root=/dev/ram0          for the rescue system
                  root=/dev/md0           for RAID

              ̂悤ɈقȂ邾łDroot=/dev/ram0 w肷ƁCRAID
              foCX̓}EgꂸCKVXeN܂D

  RAID AC̔FɎsƁCVXe̓}EgC삵
  D

  5.  M҂̎dp RAID VXe̐ݒ

  5.1.  VXe̎dl }U[{[hĂ2̃VXe̐ݒ
  ȉɎ܂D

                                    Raid-1          Raid-5
  }U[{[h:   Iwill P55TU     IDE * 2         Adaptec SCSI
  vZbT:     Intel P200
  fBXN:                       7G * 2          Segate 4.2G * 4
                                  Maxtors         Wide SCSI

  fBXNhCu RAID5 ̃}Vł 'sda'  'sdd' ƔFC
  RAID1 ̃VXeł 'hda', 'hdc' ƔFĂ܂D

  5.2.  n[hfBXÑp[eBV

  ċN ckraid ̖肪邽߁C[gɃ}Eg\ RAID AC
  eXg邱Ƃ͑ςȂ̂ŁCM҂̓Xbvp[eBV؂蒼C
  eXgp̏ RAID p[eBV(sda6,sdb6,sdc6,sdd6)ɍ
  C[gp[eBV /usr/src p[eBV̑g RAID p
  J[lƃc[̍ƗpƃeXgpɂꂼ܂D͕֗ȕ
  @Ǝv܂D

          <bf/ƗpVXe - RAID5/
     foCX     VXe        TCY  ړI

    /dev/sda1     DOS N        16M     Np[eBV
  * /dev/sda2     extended        130M    (Q)
    /dev/sda3     linux native    4G      vC} RAID5-1
  ----------------------sda2------------------------------
  * /dev/sda5     linux swap      113M    Xbv
  * /dev/sda6     linux native    16M     eXg RAID5-1
  ========================================================
    /dev/sdb1     dos boot        16M     Np[eBV
  * /dev/sdb2     extended        130M    (Q)
    /dev/sdb3     linux native    4G      vC} RAID5-2
  ----------------------sdb2------------------------------
  * /dev/sdb5     linux swap      113M    Xbv
  * /dev/sdb6     linux native    16M     eXg RAID5-2
  ========================================================
  * /dev/sdc2     extended        146M    (Q)
    /dev/sdc3     linux native    4G      vC} RAID5-3
  ----------------------sdc2------------------------------
  * /dev/sdc5     linux swap      130M    Ɨp[gp[eBV
  * /dev/sdc6     linux native    16M     eXg RAID5-3
  ========================================================
  * /dev/sdd2     extended        146M    (Q)
    /dev/sdd3     linux native    4G      vC} RAID5-4
  ----------------------sdd2------------------------------
  * /dev/sdd5     linux swap      130M    Ɨp /usr/src
  * /dev/sdd6     linux native    16M     eXg RAID-4

          <bf/ƗpVXe - RAID1/
     foCX     VXe        TCY  ړI

    /dev/hda1     DOS             16M     Np[eBV
  * /dev/hda2     extended        126M    (Q)
    /dev/hda3     linux           126M    Ɨp[gp[eBV
    /dev/hda4     linux           6+G     RAID1-1
  ----------------------hda2------------------------------
  * /dev/hda5     linux            26M    eXg RAID1-1
  * /dev/hda6     linux swap      100M
  ========================================================

    /dev/hdc1     hda1 ̒PȂRs[DāChda ̏
                  ꍇɂ̓ANeBuɂ邱Ƃł
  * /dev/hdc2     extended        126M    (Q)
    /dev/hdc3     linux           126M    Ɨp /usr/src
    /dev/hdc4     linux           6+G     RAID1-2
  ----------------------hdc2------------------------------
  * /dev/hdc5     linux            26M    eXg RAID1-2
  * /dev/hdc6     linux swap      100M

  sdx2  hdx3 p[eBV́C[eBeB̊JIɂ́C
  ̂łC Linux }ṼCuJ[l1NȏÂ
  ̂ŁC^[Qbg}Vō邱Ƃɂ܂D

  p[eBV̐؂́CfBXN̂ǂꂩĂ܂ꍇɂCV
  Xeł邾ȒPɋN悤ɂłCf[^Ȃ悤
  ߂܂D

  o  1̃n[hfBXNꂽꍇCN͎sCVXeғ
     ܂Dʏ̃bZ[WC /dosx/raidboot/raidstat.ro 𒲂ׂ
     ΁CꂽAC̃Xe[^Xm邱Ƃł܂D

  o  sda1(RAID5)  hda1(RAID1) ̏ႵꍇCDOS ̃obNAbvN
     p[eBVuANeBuvɂCBIOS  Vp[eBV
     NfoCXƂĔF邩C邢́CI xda p[eBV
     ړȂ΂Ȃ܂D̑ɁCinitrd C[Wg
     ătbs[fBXNcĂobNAbvNhCũVX
     eN邱Ƃł܂ĎCcĂX[p[ubN
     č\z邽߁C̃R}hs邱Ƃ RAID VXeĂуA
     NeBuɂ邱Ƃł܂D

              "/sbin/mkraid /etc/raid<it/x/.conf -f --only-superblock"

  o  sC

             mdadd -ar

  s܂D

  o  肪ȂƂ邽߁CAC̃Xe[^X𒲂ׁCꂩC
     ꂽfBXNC邩܂ŁCȃAC̎QƃX
     e[^X݂̃Xe[^XŒu܂D

             cat /proc/mdstat | grep md0 > /dosx/raidboot/raidgood.ref

             shutdown -r now

  ɂĐȍċNsCVXe𕜋܂D

  6.  RAID t@CVXe̍\z

  ̋Lq́CVXedlŏqׂM҂ RAID1 VXeɊւĂ̂̂
  DȂ̃VXeقȂ RAID ̃A[LeN`̗pĂꍇ
  ́CKXCĂDڂ raidtools-0.42 ɕtĂI
  C}jACQuickStart.RAID QƂĂD

  6.1.  /etc/raid5.conf

          # raid-5 configuration
          raiddev                 /dev/md0
          raid-level              5
          nr-raid-disks           4
          chunk-size              32

          # Parity placement algorithm
          parity-algorithm        left-symmetric

          # Spare disks for hot reconstruction
          #nr-spare-disks         0

          device                  /dev/sda3
          raid-disk               0

          device                  /dev/sdb3
          raid-disk               1

          device                  /dev/sdc3
          raid-disk               2

          device                  /dev/sdd3
          raid-disk               3

  6.2.  /etc/raid1.conf

          # raid-1 configuration
          raiddev                 /dev/md0
          raid-level              1
          nr-raid-disks           2
          nr-spare-disks          0

          device                  /dev/hda4
          raid-disk               0

          device                  /dev/hdc4
          raid-disk               1

  6.3.  dp RAID t@CVXe\z邽߂̋̓I菇

  M҂ RAID5 VXeł́Cȉ̂̂CXg[Ă܂D

          Slackware-3.4           ǂ̃fBXgr[Vłvł傤
          linuxthreads-0.71
          raidtools-0.42
          linux-2.0.33  raid145 pb` Gadi ̃pb`𓖂Ă

  RAID foCX쐬CtH[}bg܂D

          mkraid /etc/raid5.conf
          mdcreate raid5 /dev/md0 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3
          mdadd -ar
          mke2fs /dev/md0
          mkdir /md
          mount -t ext2 /dev/md0 /md

  reboot gQƃt@C쐬܂D͓ǎ҂̃VXeł͈قȂ
  ܂D

          cat /proc/mdstat | grep md0 > /dosa/raidboot/raidgood.ref
          cat /proc/mdstat | grep md0 > /dosb/raidboot/raidgood.ref

  Slackware-3.4 ܂͕ʂ̃pbP[WpāCOS CXg[܂D

          setup

  CXg[ɂ `/md' CCXg[ɂ͓ǎ҂igĂ
  ̂w肵܂DJ[lKvȃfBXNZbgICCXg[
  ܂D(Slackware ̏ꍇ)VXeݒ(Configure)s܂Clilo
  ƃJ[l̋N̍ڂ͔΂܂DŌ setup R}hI
  D

  `pthreads' CXg[܂D

          cd /usr/src/linuxthreads-0.71

  Makefile ҏWCϐw肵܂D

          BUILDIR=/md

          make
          make install

  `raidtools' CXg[܂D

          cd /usr/src/raidtools-0.42
          configure --sbindir=/md/sbin --prefix=/md/usr

  raidtools  `make install' ŔG[C܂D

          cd /md/sbin
          rm mdrun
          rm mdstop
          ln -s mdadd mdrun
          ln -s mdadd mdstop

  /dev/mdx ܂D

          cp -a /dev/md* /md/dev

  ݂̃VXeVXeݒǉ܂(G[͖܂)D

          cp -dp /etc/* mnt/etc
          cp -dp /etc/rc.d/* mnt/etc/rc.d         (V rc.6 ܂)
          mkdir  mnt/lib/modules
          cp -a  /lib/modules/2.x.x mnt/lib/modules <-- ݎgĂJ[l 2.x.x ̃o[W

  ȉ̃t@CҏWCǎ҂̃t@CVXeɍ킹ďC܂D

          cd /md

  lbg[N֌W
          etc/fstab       ۂ̃[gt@CVXe RAID foCXpɏC܂
          etc/mdtab       ܂삷͂ł
  lbg[N֌W
          etc/hosts
          etc/resolv.conf
          etc/hosts.equiv         yъ֘At@C
          etc/rc.d/rc.inet1       IP AhXClbg}XNCQ[gEFC
          etc/rc.d/rc.S           t@CVXẽXe[^XɂĂ̕Sč폜
                          # Test to see if the root partition isread-only
                  ̕
                          # remove /etc/mtab* so that mount will .....
                  ܂ł܂܂Ȃ悤ɂ܂DɂCRAM fBXN
                  ǂݏ\Ń}EgƏo邤邳EH[jO
                  oȂȂ܂D
          etc/rc.d/rc.xxxxx       KvȂΑ̃t@C
          root/.rhosts            ݂
          home/xxxx/xxxx          KvȂΑ̃t@C

      x:       ̑ŁCpX[hƃVhEpX[h̃t@C
                  Vt@CVXeɈڂ܂I̓ZLeB
                  ̓_́C]܂Ȃ܂D

  VXeňӂł邱ƂKv /dev/disk... }Eg邽߂̎
  쐬܂DM҂̏ꍇ͈ȉ̂悤ɂȂ܂D

          cd /md          <-- Vt@CVXẽ[g
          mkdir dosa                      DOSp[eBṼ}Eg|Cg

          mkdir dosb                      DOS ~[p[eBṼ}Eg|Cg

  Vt@CVXe͊łDmd ̎QƃXe[^X `ۂ'[g
  foCXɊmFEۑ΁CN̏͏IłD

  DOS p[eBV dosa, dosb Ƀ}Eg܂D

          cat /proc/mdstat | grep md0 > /dosa/raidboot/raidgood.ref
          cat /proc/mdstat | grep md0 > /dosb/raidboot/raidgood.ref

          mdstop /dev/md0

  7.  Ōɒӂ_

  BlƂ́CbɂĂȂ菭ȂƂ1%̂ƂmĂ
  l̂Ƃł邱ƂYȂłDɏ߂郁[o
  ɂ͂̓_YȂłD͎܂C RAID1,
  RAID5 ɂĂxȂ̂łI

  Michael Robinton Michael@bzs.org <mailto:michael@bzs.org>

  8.  t^ A. Bohumil Chalupa ɂ md0 ̃Vbg_E

  Bohumil Chalupa  Linux RAID [OXgւ̓eŁCRAID1, 5
  ł mdstop ̖̉@łD̕@ł́CVbg_E̎
  RAID foCXĂ\͑z肵Ă܂DŁCM҂u[
  g̐ȎQƃXe[^XȒPɔr悤ɂ܂DɂC
  ACɈُ킪ƂCIy[^邱Ƃł܂Dɂ
  Ă̏ڍׂ͖{ŏqׂĂ܂D
  > From: Bohumil Chalupa <bochal@apollo.karlov.mff.cuni.cz>
  >
  > initrd  linuxrc gRAID1 AC𓮂Cꂩ root 
  > /dev/md0 ɂ܂ؑւ邱Ƃł܂D
  >
  > CAC𐳏 *~߂* @͂킩܂D

  ł́C܂傤 :-)

  > Date: Mon, 29 Dec 1997 02:21:38 -0600 (CST)
  > From: Edward Welbon <welbon@bga.com>
  > Subject: Re: dismounting root raid device
  >
  > RAID0 ȊO md foCXɂẮCSĂ݂̏IĂ邱
  > m邽߂ɃXe[^XۑƎv܂DĈ悤ȃXe[
  > ^X̓[hI[Ń}Eg郋[gt@CVXeɂĂ
  > ۑ܂D̂悤ȏꍇC[hI[̃[gt@CVXe
  > ɏ݉\ȃt@CVXe "X" }Eg\ŁC"X" ɏ
  > ݂łȂĂ͂Ȃ܂(""̑łs܂C
  > ͎ł͂܂)D
  >
  > t@CVXe "X"  RAID(initrd oR linuxrc s)Xe[
  > ^X擾u[gfoCXƉ肵܂DK raid0 ̓Xe[^X
  > ݂̕Kv܂(mdstop ̌ mdtab Ƀ`FbNTo
  > ƂłΊ̂ł)D
  > Ƃ肠Ă݂܂C"devil"  "details" Ɋ܂܂
  > ܂C͂ȂłD

  łˁD
  ACfBAlĂ̂łCԂ܂łD
  ŁCĂ݂ƂC܂܂D

   RAID1(~[)ł́C`FbNTRAID̃X[p[ubÑf[^
  ̕ۑ͍sĂ܂D""̃u[gp[eBV̏C܂胋[
  gɊ蓖Ă md {[Vbg_EɃ[hI[ōă}E
  gꂽƂۑĂ܂DāCN linuxrc XNv
  g̏ mkraid --only-superblock sCꂪ
  Ȃ ckraid s܂D
  ܂CRAID ̃X[p[ubN̓Vbg_Eɂ͍XVꂸC
  NɍXV܂D
  ܂肷肵@łȂ̂łC :-( Ă͂܂D

  RAIDfoCX[gɂċN邽߂ Edward Welbon 
  initrd.md  Slackware ̑ggĂ܂D
  ̊oĂł́CCt@C mkdisk, linuxrc ƃVbg
  _Ep̃XNvg /etc/rc.d/rc.6 łD
  C lilo.conf ͏C܂D

  dvȕ[ɓYtĂ܂D

  Bohumil Chalupa

  --------------- my.linuxrc follows -----------------
  #!/bin/sh
  # we need /proc
  /bin/mount /proc
  # start up the md0 device. let the /etc/rc.d scripts get the rest of them
  # we should do as little as possible here
  # ________________________________________
  # root raid1 shutdown test & recreation
  # /start must be created on the rd image in my.mkdisk
  echo "preparing md0: mounting /start"
  /bin/mount /dev/sda2 /start -t ext2
  echo "reading saved md0 state from /start"
  if [ -f /start/root.raid.ok ]; then
   echo "raid ok, modyfying superblock"
   rm /start/root.raid.ok
   /sbin/mkraid /etc/raid1.conf -f --only-superblock
  else
   echo "raid not clean, runing ckraid --fix"
   /sbin/ckraid --fix /etc/raid1.conf
  fi
  echo "unmounting /start"
  /bin/umount /start
  # _________________________________________
  #
  echo "adding md0 for root file system"
  /sbin/mdadd /dev/md0 /dev/sda1 /dev/sdb1
  echo "starting md0"
  /sbin/mdrun -p1 /dev/md0
  # tell kernel we want to switch to /dev/md0 as root device, the 0x900 value
  # is arrived at via 256*major_device_number + minor_device number.
  echo "setting real-root-dev"
  /bin/echo 0x900>/proc/sys/kernel/real-root-dev
  #  unmount /proc so that the ram disk can be deallocated.
  echo "unmounting /proc"
  /bin/umount /proc
  /bin/echo "We are hopefully ready to mount /dev/md0 (major 9, minor 0) as
  root"
  exit
  --------------- end of my.linuxrc ----------------------------------

  ----------- extract from /etc/rc.d/rc.6 follows -----------------
    # Turn off swap, then unmount local file systems.
    echo "Turning off swap."
    swapoff -a
    echo "Unmounting local file systems."
    umount -a -tnonfs
    # Don't remount UMSDOS root volumes:
    if [ ! "`mount | head -1 | cut -d ' ' -f 5`" = "umsdos" ]; then
      mount -n -o remount,ro /
    fi

    # Save raid state
    echo "Saving RAID state"
    /bin/mount -n /dev/sda2 /start -t ext2
    touch /start/root.raid.ok
    /bin/umount -n /start

  -------------- end of excerpt from rc.6 ------------------------

  ------------------ part of my.mkdisk follows ----------------------
  #
  #  now we have the filesystem ready to be populated, we need to
  #  get a few important directories.  I had endless trouble till
  #  I created a pristine mtab.  In my case, it is convenient that
  #  /etc/mdtab is copied over, this way I can activate md with
  #  a simple "/sbin/mdadd -ar" in linuxrc.
  #
  cp -a $ROOT/etc $MOUNTPNT 2>cp.stderr 1>cp.stdout
  rm -rf $MOUNTPNT/etc/mtab
  rm -rf $MOUNTPNT/etc/ppp*
  rm -rf $MOUNTPNT/etc/termcap
  rm -rf $MOUNTPNT/etc/sendmail*
  rm -rf $MOUNTPNT/etc/rc.d
  rm -rf $MOUNTPNT/etc/dos*
  cp -a $ROOT/sbin $ROOT/dev $ROOT/lib $ROOT/bin $MOUNTPNT 2>>cp.stderr
  1>>cp.stdout
  # _____________________________________________________________________
  #  RAID: will need mkraid and ckraid
  cp -a $ROOT/usr/sbin/mkraid $ROOT/usr/sbin/ckraid $MOUNTPNT/sbin
  2>>cp.stderr 1>>cp.stdout
  # ---------------------------------------------------------------------
  #  it seems that init wont come out to play unless it has utmp.   this can
  #  probably be pruned back alot.  no telling what the real bug was 8-).
  #
  mkdir $MOUNTPNT/var $MOUNTPNT/var/log $MOUNTPNT/var/run $MOUNTPNT/initrd
  touch $MOUNTPNT/var/run/utmp $MOUNTPNT/etc/mtab
  chmod a+r $MOUNTPNT/var/run/utmp $MOUNTPNT/etc/mtab
  ln -s /var/run/utmp $MOUNTPNT/var/log/utmp
  ln -s /var/log/utmp $MOUNTPNT/etc/utmp
  ls -lstrd $MOUNTPNT/etc/utmp $MOUNTPNT/var/log/utmp $MOUNTPNT/var/run/utmp
  #
  #  since I wanted to change the mount point, I needed this though
  #  I suppose that I could have done a "mkdir /proc" in linuxrc.
  #
  mkdir $MOUNTPNT/proc
  chmod 555 $MOUNTPNT/proc
  #
  #  ------------------------------------------------------
  #  we'll mount the real boot device to /start temporarily
  #  to check the root raid state saved at shutdown time
  #
  mkdir $MOUNTPNT/start
  #  -------------------------------------------------------
  #
  #  need linuxrc  (it is, after all, the point of this exercise).
  #
  if [ -x ./my.linuxrc ]; then
    cp -a ./my.linuxrc $MOUNTPNT/linuxrc
    chmod 777 $MOUNTPNT/linuxrc
  else
     ln -s /bin/sh $MOUNTPNT/linuxrc
  fi
  #
  ----------------- part of my.mkdisk ends -----------------

  9.  Vbg_EXNvg̗

  o  ``Slackware''

  o  ``Debian''

  9.1.  Slackware - /etc/rc.d/rc.6

  #! /bin/sh
  #
  # rc.6          This file is executed by init when it goes into runlevel
  #               0 (halt) or runlevel 6 (reboot). It kills all processes,
  #               unmounts file systems and then either halts or reboots.
  #
  # Version:      @(#)/etc/rc.d/rc.6      1.50    1994-01-15
  #
  # Author:       Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
  # Modified by:  Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
  #
  # Modified by:  Michael A. Robinton < michael@bizsystems.com >
  #               to add call to rc.raidown
    # Set the path.
    PATH=/sbin:/etc:/bin:/usr/bin

    # Set linefeed mode to avoid staircase effect.
    stty onlcr

    echo "Running shutdown script $0:"

    # Find out how we were called.
    case "$0" in
          *0)
                  message="The system is halted."
                  command="halt"
                  ;;
          *6)
                  message="Rebooting."
                  command=reboot
                  ;;
          *)
                  echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
                  exit 1
                  ;;
    esac

  ############ Save raid boot and status info ##############
  #
  if [ -x /etc/rc.d/rc.raidown ]; then
     /etc/rc.d/rc.raidown
  fi
  ################## end raid boot #########################

    # Kill all processes.
    # INIT is supposed to handle this entirely now, but this didn't always
    # work correctly without this second pass at killing off the processes.
    # Since INIT already notified the user that processes were being killed,
    # we'll avoid echoing this info this time around.
    if [ "$1" != "fast" ]; then # shutdown did not already kill all processes
      killall5 -15
      killall5 -9
    fi

    # Try to turn off quota and accounting.
    if [ -x /usr/sbin/quotaoff ]
    then
          echo "Turning off quota."
          /usr/sbin/quotaoff -a
    fi
    if [ -x /sbin/accton ]
    then
          echo "Turning off accounting."
          /sbin/accton
    fi

    # Before unmounting file systems write a reboot or halt record to wtmp.
    $command -w

    # Save localtime
    [ -e /usr/lib/zoneinfo/localtime ] && cp /usr/lib/zoneinfo/localtime /etc

    # Asynchronously unmount any remote filesystems:
    echo "Unmounting remote filesystems."
    umount -a -tnfs &

    # Turn off swap, then unmount local file systems.
    echo "Turning off swap."
    swapoff -a
    echo "Unmounting local file systems."
    umount -a -tnonfs
    # Don't remount UMSDOS root volumes:
    if [ ! "`mount | head -1 | cut -d ' ' -f 5`" = "umsdos" ]; then
      mount -n -o remount,ro /
    fi

  ################ for raid arrays #########################
  # Stop all known raid arrays (except root which won't stop)
  if [ -x /sbin/mdstop ]; then
    echo "Stopping raid"
    /sbin/mdstop -a
  fi
  ##########################################################

    # See if this is a powerfail situation.
    if [ -f /etc/powerstatus ]; then
      echo "Turning off UPS, bye."
      /sbin/powerd -q
      exit 1
    fi

    # Now halt or reboot.
    echo "$message"
    [ ! -f /etc/fastboot ] && echo "On the next boot fsck will be FORCED."
    $command -f
  ############### end rc.6 #################################

  9.2.  Debian bo - /etc/init.d/halt and /etc/init.d/reboot

  The modifications shown here for Debian bo halt and reboot files are
  NOT TESTED. When you test this, please e-mail me so I can remove this
  comment.

  9.2.1.  /etc/init.d/halt

  #! /bin/sh
  #
  # halt          The commands in this script are executed as the last
  #               step in runlevel 0, ie halt.
  #
  # Version:      @(#)halt  1.10  26-Apr-1997  miquels@cistron.nl
  #

  PATH=/sbin:/bin:/usr/sbin:/usr/bin

  ############ Save raid boot and status info ##############
  #
  if [ -x /etc/rc.d/rc.raidown ]; then
     /etc/rc.d/rc.raidown
  fi
  ################## end raid boot #########################

  # Kill all processes.
  echo -n "Sending all processes the TERM signal... "
  killall5 -15
  echo "done."
  sleep 5
  echo -n "Sending all processes the KILL signal... "
  killall5 -9
  echo "done."

  # Write a reboot record to /var/log/wtmp.
  halt -w

  # Save the random seed between reboots.
  /etc/init.d/urandom stop

  echo -n "Deactivating swap... "
  swapoff -a
  echo "done."

  echo -n "Unmounting file systems... "
  umount -a
  echo "done."

  mount -n -o remount,ro /

  ################ for raid arrays #########################
  # Stop all known raid arrays (except root which won't stop)
  if [ -x /sbin/mdstop ]; then
    echo "Stopping raid"
    /sbin/mdstop -a
  fi
  ##########################################################

  # See if we need to cut the power.
  if [ -x /etc/init.d/ups-monitor ]
  then
          /etc/init.d/ups-monitor poweroff
  fi

  halt -d -f
  ############# end halt ####################

  9.2.2.  /etc/init.d/reboot

  #! /bin/sh
  #
  # reboot        The commands in this script are executed as the last
  #               step in runlevel 6, ie reboot.
  #
  # Version:      @(#)reboot  1.9  02-Feb-1997  miquels@cistron.nl
  #

  PATH=/sbin:/bin:/usr/sbin:/usr/bin

  ############ Save raid boot and status info ##############
  #
  if [ -x /etc/rc.d/rc.raidown ]; then
     /etc/rc.d/rc.raidown
  fi
  ################## end raid boot #########################

  # Kill all processes.
  echo -n "Sending all processes the TERM signal... "
  killall5 -15
  echo "done."
  sleep 5
  echo -n "Sending all processes the KILL signal... "
  killall5 -9
  echo "done."

  # Write a reboot record to /var/log/wtmp.
  halt -w

  # Save the random seed between reboots.
  /etc/init.d/urandom stop

  echo -n "Deactivating swap... "
  swapoff -a
  echo "done."

  echo -n "Unmounting file systems... "
  umount -a
  echo "done."

  mount -n -o remount,ro /

  ################ for raid arrays #########################
  # Stop all known raid arrays (except root which won't stop)
  if [ -x /sbin/mdstop ]; then
    echo "Stopping raid"
    /sbin/mdstop -a
  fi
  ##########################################################

  echo -n "Rebooting... "
  reboot -d -f -i

  10.  t^ C: ̑̐ݒt@C

  10.1.  linuxrc``linuxrc file''

  10.2.  loadlin -- linux.bat file - boot.par``linux.bat file -
  boot.par''

  10.3.  linuxthreads Makefile.diff``linuxthreads Makefile.diff''

  10.4.  raid1.conf``raid1.conf''

  10.5.  raid5.conf``raid5.conf''

  10.6.  raidboot.conf``raidboot.conf''

  10.7.  rc.raidown``rc.raidown''

  11.  t^ D: Â linuxrc ƃVbg_EXNvg

  11.1.  Ât@C - linuxurc

   linuxrc t@C͎̐߂ŎVbg_EXNvgƑgݍ
  ΐ삵܂D

   ---------------------- linuxrc --------------------
  #!/bin/sh
  # ver 1.07 2-12-98
  # linuxrc - for raid1 using small dos partition and loadlin
  #

  # mount the proc file system
  /bin/mount /proc

  # This may vary for your system.
  # Mount the dos partitions, try both
  # in case one disk is dead
  /bin/mount /dosa
  /bin/mount /dosc

  # Set a flag in case the raid status file is not found
  # then check both drives for the status file
  RAIDOWN="raidstat.ro not found"
  /bin/echo "Reading md0 shutdown status."
  if [ -f /dosa/raidboot/raidstat.ro ]; then
    RAIDOWN=`/bin/cat /dosa/raidboot/raidstat.ro`
    RAIDREF=`/bin/cat /dosc/raidboot/raidgood.ref`
  else
    if [ -f /dosc/raidboot/raidstat.ro ]; then
      RAIDOWN=`/bin/cat /dosc/raidboot/raidstat.ro`
      RAIDREF=`/bin/cat /dosc/raidboot/raidgood.ref`
    fi
  fi

  # Test for a clean shutdown with all disks operational
  if [ "${RAIDOWN} != ${RAIDREF}" ]; then
    echo "ERROR ${RAIDOWN}"
  #  Use the next 2 lines to BAIL OUT and leave rescue running
     /bin/echo 0x100>/proc/sys/kernel/real-root-dev
     exit                 # leaving the error files in dosa/raidboot,etc...
  fi

  # The raid array is clean, proceed by removing
  # status file and writing a clean superblock
  /bin/rm /dosa/raidboot/raidstat.ro
  /bin/rm /dosc/raidboot/raidstat.ro
  /sbin/mkraid /etc/raid1.conf -f --only-superblock

  /bin/umount /dosa
  /bin/umount /dosc

  # Mount raid array
  echo "Mounting md0, root filesystem"
  /sbin/mdadd -ar

  #  If there are errors - BAIL OUT and leave rescue running
  if [ $? -ne 0 ]; then
     echo "RAID device has errors"
  #  Use the next 3 lines to BAIL OUT
     /bin/rm /etc/mtab            # remove bad mtab
     /bin/echo 0x100>/proc/sys/kernel/real-root-dev
     exit
  fi

  # else tell the kernel to switch to /dev/md0 as the /root device
  # The 0x900 value the device number calculated by:
  #  256*major_device_number + minor_device number
  /bin/echo 0x900>/proc/sys/kernel/real-root-dev

  # umount /proc to deallocate initrd device ram space
  /bin/umount /proc
  /bin/echo "/dev/md0 mounted as root"
  exit
  #------------------ end linuxrc ----------------------

  11.2.  Ât@C - Vbg_EXNvg

  ̃Vbg_EXNvg͑OɎ linuxrc Ƒgݍ킹ΐ
  삵܂D

  RAID AC̃Vbg_ẼXe[^X𓾂邽߂ɁCt@CVXe
  A}Eg钼OɈȉ̍s}܂D

          RAIDSTATUS=`/bin/cat /proc/mdstat | /usr/bin/grep md0`

  SẴt@CVXeA}Eg([gt@CVXe̓A
  }Egu܂v)̕ɁCȉǉ܂D

          # root device remains mounted RO
          # mount dos file systems RW
          mount -n -o remount,ro /
          echo "Writing RAID read-only boot FLAG(s)."
          mount -n /dosa
          mount -n /dosc
          # create raid mounted RO flag in duplicate
          # containing the shutdown status of the raid array
          echo ${RAIDSTATUS} > /dosa/raidboot/raidstat.ro
          echo ${RAIDSTATUS} > /dosc/raidboot/raidstat.ro

          umount -n /dosa
          umount -n /dosc

          # Stop all the raid arrays (except root)
          echo "Stopping raid"
          mdstop -a

  ɂāC[gȊȎSĂ RAID foCXɏI܂D[
  g̃Xe[^X raidstat.ro ɕۑC̋NɎQƂ܂D

  M҂ȑO RAID1  Slackware VXeŎgĂVbg_EXN
  vg̑ŜȉɎ܂DM҂ RAID1  /etc/raidboot.conf
  t@CgV@ɏ芷Ă܂D

  #! /bin/sh
  #
  # rc.6          This file is executed by init when it goes into runlevel
  #               0 (halt) or runlevel 6 (reboot). It kills all processes,
  #               unmounts file systems and then either halts or reboots.
  #
  # Version:      @(#)/etc/rc.d/rc.6      1.50    1994-01-15
  #
  # Author:       Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
  # Modified by:  Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
  # Modified by:  Michael A. Robinton, <michael@bzs.org> for RAID shutdown

    # Set the path.
    PATH=/sbin:/etc:/bin:/usr/bin

    # Set linefeed mode to avoid staircase effect.
    stty onlcr

    echo "Running shutdown script $0:"

    # Find out how we were called.
    case "$0" in
          *0)
                  message="The system is halted."
                  command="halt"
                  ;;
          *6)
                  message="Rebooting."
                  command=reboot
                  ;;
          *)
                  echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
                  exit 1
                  ;;
    esac

    # Kill all processes.
    # INIT is supposed to handle this entirely now, but this didn't always
    # work correctly without this second pass at killing off the processes.
    # Since INIT already notified the user that processes were being killed,
    # we'll avoid echoing this info this time around.
    if [ "$1" != "fast" ]; then # shutdown did not already kill all processes
      killall5 -15
      killall5 -9
    fi

    # Try to turn off quota and accounting.
    if [ -x /usr/sbin/quotaoff ]
    then
          echo "Turning off quota."
          /usr/sbin/quotaoff -a
    fi
    if [ -x /sbin/accton ]
    then
          echo "Turning off accounting."
          /sbin/accton
    fi

    # Before unmounting file systems write a reboot or halt record to wtmp.
    $command -w

    # Save localtime
    [ -e /usr/lib/zoneinfo/localtime ] && cp /usr/lib/zoneinfo/localtime /etc

    # Asynchronously unmount any remote filesystems:
    echo "Unmounting remote filesystems."
    umount -a -tnfs &

    # you must have issued
    # 'cat /proc/mdstat | grep md0 > {your boot vol}/raidboot/raidgood.ref'
    # before linuxrc will execute properly with this info
    RAIDSTATUS=`/bin/cat /proc/mdstat | /usr/bin/grep md0 # capture raid status`

    # Turn off swap, then unmount local file systems.
    # clearing mdtab as well
    echo "Turning off swap."
    swapoff -a
    echo "Unmounting local file systems."
    umount -a -tnonfs

    # Don't remount UMSDOS root volumes:
    if [ ! "`mount | head -1 | cut -d ' ' -f 5`" = "umsdos" ]; then
      mount -n -o remount,ro /
    fi

    # root device remains mounted
    # mount dos file systems RW
    echo "Writing RAID read-only boot FLAG(s)."
    mount -n /dosa
    mount -n /dosc
    # create raid mounted RO flag in duplicate
    # containing the shutdown status of the raid array
    echo ${RAIDSTATUS} > /dosa/raidboot/raidstat.ro
    echo ${RAIDSTATUS} > /dosc/raidboot/raidstat.ro

    umount -n /dosa
    umount -n /dosc

    # Stop all the raid arrays (except root)
    echo "Stopping raid"
    mdstop -a

    # See if this is a powerfail situation.
    if [ -f /etc/power_is_failing ]; then
      echo "Turning off UPS, bye."
      /sbin/powerd -q
      exit 1
    fi

    # Now halt or reboot.
    echo "$message"
    [ ! -f /etc/fastboot ] && echo "On the next boot fsck will be FORCED."
    $command -f

  12.  t^ E: Gadi  RAID ~ɊւLinux J[lpb`

  --- linux/drivers/block/md.c.old        Fri Nov 21 13:37:11 1997
  +++ linux/drivers/block/md.c    Sat Dec  6 13:34:28 1997
  @@ -622,8 +622,13 @@
         return do_md_run (minor, (int) arg);

       case STOP_MD:
  -      return do_md_stop (minor, inode);
  -
  +      err = do_md_stop(minor, inode);
  +      if (err) {
  +        printk("md: enabling auto mdstop for %s\n",
  kdevname(inode->i_rdev));
  +        md_dev[minor].auto_mdstop = 1;
  +      }
  +      return err;
  +
       case BLKGETSIZE:   /* Return device size */
       if  (!arg)  return -EINVAL;
       err=verify_area (VERIFY_WRITE, (long *) arg, sizeof(long));
  @@ -692,6 +697,10 @@

     sync_dev (inode->i_rdev);
     md_dev[minor].busy--;
  +  if (!md_dev[minor].busy && md_dev[minor].auto_mdstop) {
  +       do_md_stop(minor, inode);
  +       md_dev[minor].auto_mdstop = 0;
  +  }
   }

   static int md_read (struct inode *inode, struct file *file,
  --- linux/include/linux/md.h~   Fri Nov 21 13:29:14 1997
  +++ linux/include/linux/md.h    Fri Nov 21 13:29:14 1997
  @@ -260,6 +260,7 @@
     int                  repartition;
     int                  busy;
     int                  nb_dev;
  +  int                  auto_mdstop;
     void                 *private;
   };

  13.  t^ F: rc.raidown

  ȉ̃eLXg rc.raidown XNvgƂāC/etc/rc.d ɃZ[u
  D

  #! /bin/sh
  #
  # rc.raidown    This file is executed by init when it goes into runlevel
  #               0 (halt) or runlevel 6 (reboot). It saves the status of
  #               a root mounted raid array for subsequent re-boot
  #
  # Version:      1.08    3-25-98 Michael A. Robinton < michael@bizsystems.com >
  #
  ############ Save raid boot and status info ##############
  if [ -f /etc/raidboot.conf ]
  then
    {
    read RaidBootDevs
    read RaidStatusPath
    read RaidConfigEtc
    } < /etc/raidboot.conf

  # you must have issued
  #       cat /proc/mdstat | grep md0 >
  #               {your boot vol mnt(s)}/{RaidStatusPath}/raidgood.ref
  # before linuxrc will execute properly with this info
  #
  #       capture raid status
    RAIDSTATUS=`/bin/cat /proc/mdstat | /usr/bin/grep md0`
    mkdir /tmp/raid$$
    echo "Writing RAID read-only boot FLAG(s)."
    for Device in ${RaidBootDevs}
    do
  # get mount point for raid boot device or use tmp
      RBmount=$( cat /proc/mounts | /usr/bin/grep ${Device} )
      if [ -n ${RBmounts} ]; then
        RBmount=$( echo ${RBmount} | cut -f 2 -d ' ' )
      else
        RBmount="/tmp/raid$$"
        mount ${Device} ${RBmount}
      fi
    if [ -d ${RBmount}/${RaidStatusPath} ]; then
  # Create raid mounted RO flag = shutdown status of raid array
      echo ${RAIDSTATUS} > ${RBmount}/${RaidStatusPath}/raidboot.ro
  # Don't propagate 'fstab' from ramdisk
      if [ -f /linuxrc ]; then
        FSTAB=
      else
        FSTAB=fstab
      fi
      pushd /etc
  # Save etc files for rescue system
      /bin/tar --ignore-failed-read \
          -cf ${RBmount}/${RaidStatusPath}/raidboot.etc \
          raid*.conf mdtab* ${FSTAB} lilo.conf
      popd
  # Create new raidboot.cfg
      {
      /bin/echo ${RaidBootDevs}
      /bin/echo ${RaidStatusPath}
      /bin/echo ${RaidConfigEtc}
      } > ${RBmount}/${RaidStatusPath}/raidboot.cfg
      /bin/umount ${RBmount}
    fi
    done
    rmdir /tmp/raid$$
    echo "Raid boot armed"
  fi
  ################## end raid boot #########################

  14.  t^ G: linuxrc ̓쌴

   RAID [gt@CVXeɃ}Eg邽߂́Clinuxrc t@
  C̕GȌ`̂̂łD̃t@C `bash' CȊÕVF
  płVFŎsȂ΂Ȃ܂D

  ̗_́CʓIłCinitrd C[WɂX^[gAbvt@C
  p[^ɈˑȂƂłD

  u[gɃJ[lɂ LILO  loadlin linuxrc ɓnꂽ
  Raid_Conf p[^́Clinuxrc KvƂNfoCX raidboot
  2̏t@C̈ʒu܂(raidboot.etc  raidboot.cfg 
  Vbg_EXNvgɂč܂)D

       raidboot.etc ͌ƂȂVXeȉɎt@C tar
       ł܂Ƃ߂̂ŁCN initrd  /etcfBNgɂȂ
       ܂D

               raid*
               mdtab*
               fstab
               lilo.conf               ( p\Ȃ )

       ӂׂ_́C̃t@C̓VXeu{ɁvNbV
       Ƃɂ́CKvɉĕҏW_łD

       raidboot.cfg  linuxrc KvƂc RAID Nt@C
       ̃pXƁCgpĂu[gp[eBVyїp\
       obNAbvp[eBV̖OĂ܂D̃t@C
       ͒ʏCVbg_Et@Cɂč쐬܂CKv
       Ď蓮ō邱Ƃ܂D

       raidboot.cfg 3sCRǧ`łD

               /dev/bootdev1 /dev/bootdev2 [/dev/bootdev3 ... ]
               raid-status/path
               name_of_raidX.conf_file

       raid-status/path ̓}Eg|Cg̖O͊܂݂܂D

       raidX.conf ̃t@C /etc fBNĝ̂ŁCʏ
        ckraid  mkraid ̂߂ɗp܂D

  ȉ̒ǉt@ĆCƎgp RAID Np[eBVɒu
  D͏ŏqׂ̂Ɠ̂łC펖Ԃɂ͗p\ȔCӂ̏
  (Ⴆ΋Ntbs[fBXN)烍[h邱Ƃł܂D

  o  raidgood.ref ͎̃R}hɂč쐬܂D cat /proc/mdstat
     | grep md0 > /{raid_status_path}/raidgood.ref

     ̃t@CƂ̎̃t@CZ[uꍇ́C``Vbg_E
     XNvg''̏͂QƂĂD

  o  raidstat.ro ̓Vbg_Eɖ rc XNvgɂč쐬
     CRAID AC̏IXe[^Xۑ܂D

