1)標準ファームの HDD を SATA2 にだけ接続して起動
2)ハックキットをインストールする HDD を USB で接続する
3)自動的にマウントされるので、アンマウント
(fdisk でパーティションを切る)
4)/dev/sdb1 を /dev/md0 に追加
5)/dev/sdb2 を /dev/md1 に追加
6)/dev/sdb5 を /dev/md10 に追加
USB で接続しているのは、U-Boot から認識されないから。
SATA につないでコピーしようとすると、
sdb1 にある initrd が U-Boot に読まれないよう、
消したりフォーマットしたりと何かと面倒なので。
何度も繰り返しているので、
3)~6)はスクリプト化している。
繰り返す操作はさっさとスクリプト化
できるのが Unix + CUI のよいところ。
root@LS-WSGL678:~# cat copytousbhdd #!/bin/sh umount /mnt/usbdisk1 mdadm -a /dev/md0 /dev/sdb1 mdadm -a /dev/md1 /dev/sdb2 mdadm -a /dev/md10 /dev/sdb5 root@LS-WSGL678:~#スクリプトを実行。
root@LS-WSGL678:~# sh copytousbhdd mdadm: re-added /dev/sdb1 mdadm: re-added /dev/sdb2 mdadm: re-added /dev/sdb5 root@LS-WSGL678:~# root@LS-WSGL678:~# cat /proc/mdstat Personalities : [raid0] [raid1] md1 : active raid1 sdb2[2] sda2[0] 5004160 blocks [2/1] [U_] resync=DELAYED md10 : active raid1 sdb5[1] sda5[0] 1003904 blocks [2/1] [U_] resync=DELAYED md0 : active raid1 sdb1[1] sda1[0] 1003904 blocks [2/1] [U_] [=======>.............] recovery = 39.0% (392448/1003904) finish=0.5min speed=17147K/sec unused devices: <none> root@LS-WSGL678:~#あとは、cat /proc/mdstat を繰り返して、 リビルド(リカバリ)が完了するまで、10分ほど、 腹筋と腕立て伏せをして?待つ。
root@LS-WSGL678:~# cat /proc/mdstat Personalities : [raid0] [raid1] md1 : active raid1 sdb2[1] sda2[0] 5004160 blocks [2/2] [UU] md10 : active raid1 sdb5[1] sda5[0] 1003904 blocks [2/2] [UU] md0 : active raid1 sdb1[1] sda1[0] 1003904 blocks [2/2] [UU] unused devices: <none> root@LS-WSGL678:~#一台目終わり。
USB を抜いて、2台目を接続、繰り返す。
次は、背筋とスクワットをして待つ(笑)
2台目が完了すれば、シャットダウン。
BUFFALO INC. LinkStation series LS-WSGL678 login: root root@LS-WSGL678:~#中ではリカバリが進んでいる。
root@LS-WSGL678:~# cat /proc/mdstat Personalities : [raid0] [raid1] md1 : active raid1 sda2[2] sdb2[1] 5004160 blocks [2/1] [_U] [========>............] recovery = 43.9% (2201472/5004160) finish=1.1min speed=40464K/sec md10 : active raid1 sda5[0] sdb5[1] 1003904 blocks [2/2] [UU] md0 : active raid1 sda1[0] sdb1[1] 1003904 blocks [2/2] [UU] unused devices: <none> root@LS-WSGL678:~#info LED が消えるまで、ストレッチをして待つ。
root@LS-WSGL678:~# cat /proc/mdstat Personalities : [raid0] [raid1] md1 : active raid1 sda2[0] sdb2[1] 5004160 blocks [2/2] [UU] md10 : active raid1 sda5[0] sdb5[1] 1003904 blocks [2/2] [UU] md0 : active raid1 sda1[0] sdb1[1] 1003904 blocks [2/2] [UU] unused devices: <none> root@LS-WSGL678:~#準備完了。
root@LS-WSGL678:~# sh /mnt/disk1/hackkit/LS-WSGL_hackkit_step1_0.02.sh Extracting initrd... 87438+1 records in 87438+1 records out mounting initrd... editing linuxrc... clearing root's password... rebuilding initrd.buffalo... gziping initrd ... wait 5 minutes Image Name: initrd Created: Thu Oct 30 09:26:26 2008 Image Type: ARM Linux RAMDisk Image (gzip compressed) Data Size: 5598467 Bytes = 5467.25 kB = 5.34 MB Load Address: 0x00000000 Entry Point: 0x00000000 root@LS-WSGL678:~#gzip している5分を待つ間には、腿上げ。
BUFFALO INC. LinkStation series LS-WSGL-EM678 login: root BusyBox v1.1.1 (2008.07.15-06:14+0000) Built-in shell (ash) Enter 'help' for a list of built-in commands. #
# mkdir /mnt/disk1 mkdir: Cannot create directory `/mnt/disk1': File exists # mount /dev/sda6 /mnt/disk1 # ls /mnt/disk1/hackkit LS-WSGL_hackkit_step1_0.01.sh hackkit_080317.tar.gz LS-WSGL_hackkit_step2_0.03.sh mkimage #
# sh /mnt/disk1/hackkit/LS-WSGL_hackkit_step2_0.09.sh : : checking /dev/md0 ... fsck 1.27 (8-Mar-2002) e2fsck 1.27 (8-Mar-2002) /dev/md0 was not cleanly unmounted, check forced. Pass 1: Checking inodes, blocks, and sizes Deleted inode 17 has zero dtime. Fix? yes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Block bitmap differences: -(58612--62712) Fix? yes Free blocks count wrong for group #1 (2823, counted=6924). Fix? yes Free blocks count wrong (212727, counted=216828). Fix? yes Inode bitmap differences: -17 Fix? yes Free inodes count wrong for group #0 (15692, counted=15693). Fix? yes Free inodes count wrong (125676, counted=125677). Fix? yes /dev/md0: ***** FILE SYSTEM WAS MODIFIED ***** /dev/md0: 19/125696 files (15.8% non-contiguous), 34148/250976 blocks extracting initrd ... mounting initrd... editing linuxrc ... rebuilding initrd.buffalo ... gziping initrd ... wait 5 minutesインストールが完了するまで、屈伸運動をして待つ。
Image Name: initrd Created: Thu Oct 30 21:48:15 2008 Image Type: ARM Linux RAMDisk Image (gzip compressed) Data Size: 5598606 Bytes = 5467.39 kB = 5.34 MB Load Address: 0x00000000 Entry Point: 0x00000000 umount: /boot: device is busy umount: /boot: device is busy #相変わらずの fsck と /boot のアンマウントエラー。
---- in hackkit linuxrc --- -- rebuild mdadm.conf for BOOT, ROOTFS -- md: md10 stopped. mdadm: /dev/disk2_1 has wrong uuid. mdadm: /dev/disk1_1 has wrong uuid. mdadm: /dev/disk2_2 has wrong uuid. mdadm: /dev/disk1_2 has wrong uuid. md: bind<sdb5> md: bind<sda5> raid1: raid set md10 active with 2 out of 2 mirrors mdadm: /dev/md10md: md1 stopped. has been started with 2 drives. mdadm: /dev/disk2_1 has wrong uuid. mdadm: /dev/disk1_1 has wrong uuid. md: bind<sdb2> md: bind<sda2> raid1: raid set md1 active with 2 out of 2 mirrors mdadm: /dev/md1 md: md0 stopped. has been started with 2 drives. md: bind<sdb1> md: bind<sda1> raid1: raid set md0 active with 2 out of 2 mirrors mdadm: /dev/md0 has been started with 2 drives. -- setup max error counts -- /sys/block/md0/md/maxerr_cnt is setted to -1 /sys/block/md1/md/maxerr_cnt is setted to -1 /sys/block/md10/md/maxerr_cnt is setted to -1 XFS mounting filesystem md1 VFS: Mounted root (xfs filesystem). Trying to move old root to /initrd ... okay Freeing init memory: 112K INIT: version 2.86 booting Activating swap:swapon on /dev/md10 Adding 1003896k swap on /dev/md10. Priority:-1 extents:1 across:1003896k . Setting the system clock.. System Clock set. Local time: Thu Oct 30 09:45:11 JST 2008. Cleaning up ifupdown.... Loading device-mapper support. Will now check all file systems. fsck 1.40-WIP (14-Nov-2006) Checking all file systems. Done checking file systems. A log is being saved in /var/log/fsck/checkfs if that location is writable. Setting kernel variables...done. Will now mount local filesystems:EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended XFS mounting filesystem sda6 XFS mounting filesystem sdb6 . Will now activate swapfile swap:done. Cleaning /tmp...done. Cleaning /var/run...done. Cleaning /var/lock...done. Setting up networking.... Configuring network interfaces...eth0: link down done. Setting console screen modes and fonts. Initializing random number generator...done. INIT: Entering runlevel: 2 Starting system log daemon: syslogd. Starting kernel log daemon: klogd. eth0: link up<5>, full duplex<5>, speed 1 Gbps<5> Starting MTA: exim4. Starting internet superserver: inetd. Starting deferred execution scheduler: atdStarting periodic command scheduler: crond. usbcore: registered new driver usbfs usbcore: registered new driver hub ehci_platform ehci_platform.4523: EHCI Platform Host Controller ehci_platform ehci_platform.4523: new USB bus registered, assigned bus number 1 ehci_platform ehci_platform.4523: irq 17, io mem 0x00000000 ehci_platform ehci_platform.4523: USB 0.0 started, EHCI 1.00, driver 10 Dec 2004 usb usb1: configuration #1 chosen from 1 choice hub 1-0:1.0: USB hub found hub 1-0:1.0: 1 port detected ehci_platform ehci_platform.16781: EHCI Platform Host Controller ehci_platform ehci_platform.16781: new USB bus registered, assigned bus number 2 ehci_platform ehci_platform.16781: irq 12, io mem 0x00000000 ehci_platform ehci_platform.16781: USB 0.0 started, EHCI 1.00, driver 10 Dec 2004 usb usb2: configuration #1 chosen from 1 choice hub 2-0:1.0: USB hub found hub 2-0:1.0: 1 port detected Initializing USB Mass Storage driver... usbcore: registered new driver usb-storage USB Mass Storage support registered. usbcore: registered new driver usblp drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver Running local boot scripts (/etc/rc.local). Debian GNU/Linux 4.0 hackkit ttyS0 hackkit login: BuffaloSwPollingCheck> SW_POWER_ON今度はモジュールの警告も出ず。fsck のお勧めぐらい。
できたぁ!
|
← ハックキットの再確認 |
ハックの記録 LinkStation/玄箱 をハックしよう |
→ USB デバイス認識の確認 |