玄箱PROの本体背面にある赤いボタンがRESETボタンだ。
動作内容
標準Linuxでのこのボタンの動作順序は以下となる。
- システム起動時に/etc/init.d/rcSが/etc/init.d/Kevent.shを実行する
- /etc/init.d/Kevent.shが/usr/local/sbin/Keventdを起動する
- /usr/local/sbin/Keventdはデーモンとして常駐しカーネルイベントを参照、変化があっても無くても常にその結果を/usr/local/bin/KeventHandller.shに渡す
- その都度呼び出された/usr/local/bin/KeventHandller.shはLANの状態と、miconaplコマンドで電源ボタン・RESETボタンを監視しており、RESETボタンを押されたことを認識すると/usr/local/bin/InitDisk1.shを実行する
これらの動作は標準Linuxで完備されており、独自にユーザーランドを構築した場合はこの機能は失われる。
必要であれば導入するしかない。
必要であれば導入するしかない。
HDDの初期化
Linuxの形式に初期化されていなければRESETボタンの長押しでHDDの初期化が開始される。
シリアルコンソールでのログ
~ # SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB) SCSI device sda: drive cache: write back sda: sda1 SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB) SCSI device sda: drive cache: write back sda: sda1 XFS mounting filesystem sda1 ~ #
telnetでのログ
telnetではコンソール上には何も表示されない。ある程度のタイミングを見計らってmountコマンドででも確認すればいいだろう。
パーティションの状態
fdiskコマンド?で確認してみる。
~ # fdisk /dev/sda The number of cylinders for this disk is set to 9729. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): p Disk /dev/sda: 80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 9729 78148161 83 Linux Command (m for help):
~ # mount | grep sda1 /dev/sda1 on /mnt/disk1 type xfs (rw) ~ #
xfs形式で/mnt/disk1にマウントされている。
動作を追跡する
エラー
RESETボタンを長押しすることで発生するエラーには以下のパターンがある。
KeventHandller.sh(InitDisk1.sh)が反応する既定のエラーだけを列記するので、独自に記述したシェルスクリプトなどは考慮しない。
KeventHandller.sh(InitDisk1.sh)が反応する既定のエラーだけを列記するので、独自に記述したシェルスクリプトなどは考慮しない。
- (エラー)disk is already mounted!
- (エラー)disk is already formatted!
- (エラー)RESETボタンでの初期化中、INFO LEDが点滅して作業が中断する