2015年8月23日日曜日

NASの自作 Part21

あまり調査する時間が無くて、未だ再起動後にRAIDが認識できなくなる問題を解決できていませんが、途中経過をメモ書きします。
まず、OMV起動時のログを dmesg コマンドで確認してみます。

root@OMV-NODE804:~# dmesg | egrep '(sd|md)'
[    3.560597] md: md0 stopped.
[    3.561040] md: bind
[    3.561150] md: bind
[    4.054680] md: raid6 personality registered for level 6
[    4.054682] md: raid5 personality registered for level 5
[    4.054683] md: raid4 personality registered for level 4
[    4.054831] md/raid:md0: device sdb operational as raid disk 0
[    4.054833] md/raid:md0: device sdc operational as raid disk 1
[    4.055212] md/raid:md0: allocated 10592kB
[    4.055228] md/raid:md0: not enough operational devices (8/10 failed)
[    4.055333]  disk 0, o:1, dev:sdb
[    4.055335]  disk 1, o:1, dev:sdc
[    4.055588] md/raid:md0: failed to run raid set.
[    4.055680] md: pers->run() failed ...
[    4.169542] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[    5.635074] Adding 4789244k swap on /dev/sda5.  Priority:-1 extents:1 across:4789244k SS
[    5.638193] EXT4-fs (sda1): re-mounted. Opts: (null)
[    5.699219] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[    6.236823] sd 6:0:0:0: [sdd] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    6.236834] sd 6:0:0:0: [sdd] 4096-byte physical blocks
[    6.236873] sd 6:0:0:0: Attached scsi generic sg3 type 0
[    6.236955] sd 6:0:0:0: [sdd] Write Protect is off
[    6.236964] sd 6:0:0:0: [sdd] Mode Sense: 00 3a 00 00
[    6.237012] sd 6:0:0:0: [sdd] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.237352] sd 6:0:1:0: [sde] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    6.237361] sd 6:0:1:0: [sde] 4096-byte physical blocks
[    6.237469] sd 6:0:1:0: [sde] Write Protect is off
[    6.237478] sd 6:0:1:0: [sde] Mode Sense: 00 3a 00 00
[    6.237527] sd 6:0:1:0: [sde] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.238031] sd 6:0:1:0: Attached scsi generic sg4 type 0
[    6.238896] sd 6:0:2:0: [sdf] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    6.238906] sd 6:0:2:0: [sdf] 4096-byte physical blocks
[    6.238980] sd 6:0:2:0: Attached scsi generic sg5 type 0
[    6.239017] sd 6:0:2:0: [sdf] Write Protect is off
[    6.239025] sd 6:0:2:0: [sdf] Mode Sense: 00 3a 00 00
[    6.239072] sd 6:0:2:0: [sdf] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.239544] sd 6:0:3:0: Attached scsi generic sg6 type 0
[    6.240031] sd 6:0:4:0: [sdh] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    6.240041] sd 6:0:4:0: Attached scsi generic sg7 type 0
[    6.240052] sd 6:0:4:0: [sdh] 4096-byte physical blocks
[    6.240108] sd 6:0:3:0: [sdg] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    6.240116] sd 6:0:3:0: [sdg] 4096-byte physical blocks
[    6.240302] sd 6:0:4:0: [sdh] Write Protect is off
[    6.240312] sd 6:0:4:0: [sdh] Mode Sense: 00 3a 00 00
[    6.240341] sd 6:0:3:0: [sdg] Write Protect is off
[    6.240349] sd 6:0:3:0: [sdg] Mode Sense: 00 3a 00 00
[    6.240464] sd 6:0:4:0: [sdh] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.240576] sd 6:0:5:0: Attached scsi generic sg8 type 0
[    6.240587] sd 6:0:3:0: [sdg] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.241531] sd 6:0:6:0: Attached scsi generic sg9 type 0
[    6.242054] sd 6:0:7:0: Attached scsi generic sg10 type 0
[    6.242269] sd 6:0:5:0: [sdi] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    6.242277] sd 6:0:5:0: [sdi] 4096-byte physical blocks
[    6.242377] sd 6:0:5:0: [sdi] Write Protect is off
[    6.242385] sd 6:0:5:0: [sdi] Mode Sense: 00 3a 00 00
[    6.242432] sd 6:0:5:0: [sdi] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.245720] sd 6:0:6:0: [sdj] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    6.245730] sd 6:0:6:0: [sdj] 4096-byte physical blocks
[    6.245822] sd 6:0:6:0: [sdj] Write Protect is off
[    6.245830] sd 6:0:6:0: [sdj] Mode Sense: 00 3a 00 00
[    6.245872] sd 6:0:6:0: [sdj] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.249612] sd 6:0:7:0: [sdk] 5860533168 512-byte logical blocks: (3.00 TB/2.72 TiB)
[    6.249622] sd 6:0:7:0: [sdk] 4096-byte physical blocks
[    6.249716] sd 6:0:7:0: [sdk] Write Protect is off
[    6.249724] sd 6:0:7:0: [sdk] Mode Sense: 00 3a 00 00
[    6.249766] sd 6:0:7:0: [sdk] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    6.774703]  sdd: unknown partition table
[    6.774877] sd 6:0:0:0: [sdd] Attached SCSI disk
[    6.785379]  sdf: unknown partition table
[    6.785520] sd 6:0:2:0: [sdf] Attached SCSI disk
[    6.785920]  sdi: unknown partition table
[    6.786026] sd 6:0:5:0: [sdi] Attached SCSI disk
[    6.790591]  sde: unknown partition table
[    6.790714] sd 6:0:1:0: [sde] Attached SCSI disk
[    6.791452]  sdh: unknown partition table
[    6.791556] sd 6:0:4:0: [sdh] Attached SCSI disk
[    6.792948]  sdg: unknown partition table
[    6.793075] sd 6:0:3:0: [sdg] Attached SCSI disk
[    6.832251]  sdj: unknown partition table
[    6.832397] sd 6:0:6:0: [sdj] Attached SCSI disk
[    6.835789]  sdk: unknown partition table
[    6.835910] sd 6:0:7:0: [sdk] Attached SCSI disk
[    6.847249] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

予想通り、RAIDの構築後にsdd〜sdkのHDDが認識されているようです。
次に起動時の処理を調べてみると、OMV(debian)は /etc/inittab -> /etc/init.d/rcS -> /etc/init.d/rc の順番で初期化処理を実行していくようです。
そして /etc/init.d にある各種初期化用のスクリプトを実行するわけですが、実行順序の依存関係は /etc/init.d/.depend.boot に書かれています。

root@OMV-NODE804:~# cat /etc/init.d/.depend.boot
TARGETS = mountkernfs.sh udev mountdevsubfs.sh bootlogd keyboard-setup hwclock.sh hostname.sh hdparm checkroot.sh mdadm-raid checkroot-bootclean.sh mtab.sh kmod lvm2 checkfs.sh mountall.sh mountall-bootclean.sh resolvconf urandom procps udev-mtab openmediavault networking rpcbind nfs-common mountnfs.sh console-setup mountnfs-bootclean.sh quota kbd bootmisc.sh stop-bootlogd-single
INTERACTIVE = udev keyboard-setup checkroot.sh checkfs.sh console-setup kbd
udev: mountkernfs.sh
mountdevsubfs.sh: mountkernfs.sh udev
bootlogd: mountdevsubfs.sh
keyboard-setup: bootlogd mountkernfs.sh udev
hwclock.sh: mountdevsubfs.sh bootlogd
hostname.sh: bootlogd
hdparm: bootlogd mountdevsubfs.sh udev
checkroot.sh: hwclock.sh mountdevsubfs.sh hostname.sh hdparm bootlogd keyboard-setup
mdadm-raid: mountkernfs.sh hostname.sh udev
checkroot-bootclean.sh: checkroot.sh
mtab.sh: checkroot.sh
kmod: checkroot.sh
lvm2: mountdevsubfs.sh udev mdadm-raid bootlogd
checkfs.sh: mdadm-raid lvm2 checkroot.sh mtab.sh
mountall.sh: mdadm-raid lvm2 checkfs.sh checkroot-bootclean.sh
mountall-bootclean.sh: mountall.sh
resolvconf: mountall.sh mountall-bootclean.sh
urandom: mountall.sh mountall-bootclean.sh hwclock.sh
procps: bootlogd mountkernfs.sh mountall.sh mountall-bootclean.sh udev
udev-mtab: udev mountall.sh mountall-bootclean.sh
openmediavault: mountall.sh mountall-bootclean.sh
networking: resolvconf mountkernfs.sh mountall.sh mountall-bootclean.sh urandom
rpcbind: networking mountall.sh mountall-bootclean.sh
nfs-common: rpcbind hwclock.sh
mountnfs.sh: mountall.sh mountall-bootclean.sh networking rpcbind nfs-common
console-setup: mountall.sh mountall-bootclean.sh mountnfs.sh mountnfs-bootclean.sh kbd
mountnfs-bootclean.sh: mountall.sh mountall-bootclean.sh mountnfs.sh
quota: mountall.sh mountall-bootclean.sh mountnfs.sh mountnfs-bootclean.sh
kbd: mountall.sh mountall-bootclean.sh mountnfs.sh mountnfs-bootclean.sh
bootmisc.sh: checkroot-bootclean.sh mountall.sh mountall-bootclean.sh mountnfs.sh mountnfs-bootclean.sh udev
stop-bootlogd-single: mountall.sh mountall-bootclean.sh udev keyboard-setup console-setup mountnfs.sh mountnfs-bootclean.sh networking rpcbind nfs-common quota resolvconf hwclock.sh mountdevsubfs.sh checkroot.sh mountkernfs.sh urandom mdadm-raid hostname.sh checkfs.sh kbd lvm2 checkroot-bootclean.sh bootmisc.sh mtab.sh kmod hdparm bootlogd procps udev-mtab openmediavault

この中でRAIDを構築しようとしているスクリプトは mdadm-raid です。
依存関係には
mdadm-raid: mountkernfs.sh hostname.sh udev
と書かれており、これは mdadm-raid を実行する前に、mountkernfs.sh と hostname.sh と udev の3つのスクリプトを実行しておかなければいけないという意味になります。
そして udev がドライバをロードするためのスクリプトのようです。なので依存関係的にはRAIDを構築する前にドライバをロードしていることになり、特に問題は無いように思えます。おそらくドライバがロードされるイコール、HDDが認識されるわけではないのが問題のような気がします。ここを参考に mdadm-raid スクリプトを編集してRAIDの構築コマンドを実行する前に sleep で3分ほど待つようにしてみましたが、改善されませんでした。
ADAPTEC ASA-6805Hのドライバは pm80xx という名前なのですが、この振る舞いを調べる必要があるのかもしれません。

root@OMV-NODE804:/etc/init.d# modinfo pm80xx
filename:       /lib/modules/3.2.0-4-amd64/extra/pm80xx/pm80xx.ko
license:        GPL
version:        0.1.37 / 1.2.0-10624
description:    PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 SAS/SATA controller driver
author:         Jack Wang jack_wang@usish.com
srcversion:     3D89A8932F77FEC4538B458
alias:          pci:v00009005d00008076sv00001458sd00001600bc*sc*i*
...
alias:          pci:v000011F8d00008001sv*sd*bc*sc*i*
depends:        libsas,scsi_mod,scsi_transport_sas
vermagic:       3.2.0-4-amd64 SMP mod_unload modversions

調べて解決できなかった場合は、OVM起動後に以下のスクリプトを実行してRAIDを再構築させればいいかなと思っています。ちょっとカッコ悪いですが。
mdadm --stop /dev/md0
mdadm --assemble --scan

0 件のコメント:

コメントを投稿