/usr/share/doc/HOWTO/ja-html/Root-RAID-HOWTO-11.html is in doc-linux-ja-html 2006.05.25-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
<TITLE>Root RAID HOWTO cookbook: $BIUO?(B D: $B8E$$(B linuxrc $B$H%7%c%C%H%@%&%s%9%/%j%W%H(B </TITLE>
<LINK HREF="Root-RAID-HOWTO-12.html" REL=next>
<LINK HREF="Root-RAID-HOWTO-10.html" REL=previous>
<LINK HREF="Root-RAID-HOWTO.html#toc11" REL=contents>
</HEAD>
<BODY>
<A HREF="Root-RAID-HOWTO-12.html">$B<!$N%Z!<%8(B</A>
<A HREF="Root-RAID-HOWTO-10.html">$BA0$N%Z!<%8(B</A>
<A HREF="Root-RAID-HOWTO.html#toc11">$BL\<!$X(B</A>
<HR>
<H2><A NAME="Appendix-D"></A> <A NAME="s11">11.</A> <A HREF="Root-RAID-HOWTO.html#toc11">$BIUO?(B D: $B8E$$(B linuxrc $B$H%7%c%C%H%@%&%s%9%/%j%W%H(B </A></H2>
<H2><A NAME="ss11.1">11.1</A> <A HREF="Root-RAID-HOWTO.html#toc11.1">$B8E$$%U%!%$%k(B – linuxurc</A>
</H2>
<P>$B$3$N(B linuxrc $B%U%!%$%k$O<!$N@a$G<($9%7%c%C%H%@%&%s%9%/%j%W%H$HAH$_9g$o(B
$B$;$l$P@5$7$/F0:n$7$^$9!%(B
<PRE>
---------------------- 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 ----------------------
</PRE>
</P>
<H2><A NAME="ss11.2">11.2</A> <A HREF="Root-RAID-HOWTO.html#toc11.2">$B8E$$%U%!%$%k(B – $B%7%c%C%H%@%&%s%9%/%j%W%H(B</A>
</H2>
<P>$B$3$N%7%c%C%H%@%&%s%9%/%j%W%H$OA0$K<($7$?(B <B>linuxrc</B> $B$HAH$_9g$o$;$l$P(B
$B@5$7$/F0:n$7$^$9!%(B</P>
<P>RAID $B%"%l%$$N%7%c%C%H%@%&%s;~$N%9%F!<%?%9$rF@$k$?$a$K!$%U%!%$%k%7%9%F(B
$B%`$r%"%s%^%&%s%H$9$kD>A0$K0J2<$N9T$rA^F~$7$^$9!%(B
<PRE>
RAIDSTATUS=`/bin/cat /proc/mdstat | /usr/bin/grep md0`
</PRE>
$BA4$F$N%U%!%$%k%7%9%F%`$r%"%s%^%&%s%H$7$?8e(B($B%k!<%H%U%!%$%k%7%9%F%`$O%"(B
$B%s%^%&%s%H!V$5$l$^$;$s!W(B)$B$NItJ,$K!$0J2<$rDI2C$7$^$9!%(B
<PRE>
# 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
</PRE>
$B$3$l$K$h$C$F!$%k!<%H0J30$NA4$F$N(B RAID $B%G%P%$%9$,@5>o$K=*N;$7$^$9!%%k!<(B
$B%H$N%9%F!<%?%9$O(B <B>raidstat.ro</B> $B$KJ]B8$5$l!$<!2s$N5/F0;~$K;2>H$5$l$^(B
$B$9!%(B</P>
<P>$BI.<T$,0JA0$K(B RAID1 $B$N(B Slackware $B%7%9%F%`$G;H$C$F$$$?%7%c%C%H%@%&%s%9%/(B
$B%j%W%H$NA4BN$r0J2<$K<($7$^$9!%I.<T$O(B RAID1 $B$+$i(B /etc/raidboot.conf $B%U%!(B
$B%$%k$r;H$&?7$7$$J}K!$K>h$j49$($F$$$^$9!%(B
<PRE>
#! /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
</PRE>
</P>
<HR>
<A HREF="Root-RAID-HOWTO-12.html">$B<!$N%Z!<%8(B</A>
<A HREF="Root-RAID-HOWTO-10.html">$BA0$N%Z!<%8(B</A>
<A HREF="Root-RAID-HOWTO.html#toc11">$BL\<!$X(B</A>
</BODY>
</HTML>
|