debian 化(23)セルフで sda の作り直し

LS-WSGL/R1

sda1 があると、存在しないファームウェアを読み込もうとしてしまうようだ。
sda1 がない状態、つまり sda としてパーティションのない HDD を 接続すれば LS-WSGL が起動するだろう。 起動さえすれば、LS-WSGL でパーティションを切り、フォーマット、 ミラーリングを行えばよい。

LS-GL でパーティションを削除

もう一回 LS-GL に USB で接続して、 パーティションを削除する。
ude:~# fdisk /dev/sdb

The number of cylinders for this disk is set to 38913.
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/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         125     1004031   83  Linux
/dev/sdb2             126         748     5004247+  83  Linux
/dev/sdb4             749       38913   306560362+   5  Extended
/dev/sdb5             749         873     1004031   82  Linux swap / Solaris
/dev/sdb6             874       38913   305556268+  83  Linux

Command (m for help): d
Partition number (1-6): 6

Command (m for help): d
Partition number (1-5): 5

Command (m for help): d
Partition number (1-5): 4

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
ude:~#

もう一回 LS-WSGL に接続

こんどこそ。

:

今度は、立ち上がってきた。

Debian GNU/Linux 4.0 mini ttyS0

mini login: root
Password:
Last login: Thu Nov  1 00:07:19 2007 on ttyS0
Linux mini 2.6.16.16-arm1 #316 Tue Jul 22 16:22:33 JST 2008 armv5tejl

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
mini:~# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb2[0]
      5004160 blocks [2/1] [U_]

md10 : active raid1 sdb5[1]
      1003904 blocks [2/1] [_U]

md0 : active raid1 sdb1[0]
      1003904 blocks [2/1] [U_]

unused devices: 
mini:~#

パーティションを切る

sda のパーティションを切る

まずはサイズの確認。

mini:~# fdisk -l /dev/sdb

Disk /dev/sdb: 163.9 GB, 163928604672 bytes
255 heads, 63 sectors/track, 19929 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         125     1004031   83  Linux
/dev/sdb2             126         748     5004247+  83  Linux
/dev/sdb4             749       19929   154071382+   5  Extended
/dev/sdb5             749         873     1004031   83  Linux
/dev/sdb6             874       19929   153067288+  83  Linux
mini:~#
あら、こいつも sdb5 が Linux.

同様に sda にパーティションを切る。

mini:~# fdisk /dev/sda

The number of cylinders for this disk is set to 38913.
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: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-38913, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-38913, default 38913): 125

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (126-38913, default 126):
Using default value 126
Last cylinder or +size or +sizeM or +sizeK (126-38913, default 38913): 748

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 4
First cylinder (749-38913, default 749):
Using default value 749
Last cylinder or +size or +sizeM or +sizeK (749-38913, default 38913):
Using default value 38913

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (749-38913, default 749):
Using default value 749
Last cylinder or +size or +sizeM or +sizeK (749-38913, default 38913): 873

Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (874-38913, default 874):
Using default value 874
Last cylinder or +size or +sizeM or +sizeK (874-38913, default 38913):
Using default value 38913

Command (m for help): p

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         125     1004031   83  Linux
/dev/sda2             126         748     5004247+  83  Linux
/dev/sda4             749       38913   306560362+   5  Extended
/dev/sda5             749         873     1004031   83  Linux
/dev/sda6             874       38913   305556268+  83  Linux

Command (m for help): t
Partition number (1-6): 5
Hex code (type L to list codes): 82
Changed system type of partition 5 to 82 (Linux swap / Solaris)

Command (m for help): p

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         125     1004031   83  Linux
/dev/sda2             126         748     5004247+  83  Linux
/dev/sda4             749       38913   306560362+   5  Extended
/dev/sda5             749         873     1004031   82  Linux swap / Solaris
/dev/sda6             874       38913   305556268+  83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
SCSI device sda: drive cache: write back
 sda: sda1 sda2 sda4 < sda5 sda6 >
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
SCSI device sda: drive cache: write back
 sda: sda1 sda2 sda4 < sda5 sda6 >
Syncing disks.
mini:~#

フォーマット

mini:~# mkfs.ext3 -j /dev/sda1
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125696 inodes, 251007 blocks
12550 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=260046848
8 block groups
32768 blocks per group, 32768 fragments per group
15712 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
mini:~# mkfs.ext3 -j /dev/sda2
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
626496 inodes, 1251061 blocks
62553 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1283457024
39 block groups
32768 blocks per group, 32768 fragments per group
16064 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
mini:~# mkfs.ext3 -j /dev/sda6
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
38207488 inodes, 76389067 blocks
3819453 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
2332 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
mini:~# mkfs.xfs -f /dev/sda2
meta-data=/dev/sda2              isize=256    agcount=8, agsize=156382 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=1251056, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=2560, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0
mini:~# mkfs.xfs -f /dev/sda6
meta-data=/dev/sda6              isize=256    agcount=16, agsize=4774316 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=76389056, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=32768, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0
mini:~# mkswap /dev/sda5
Setting up swapspace version 1, size = 1028120 kB
no label, UUID=e8e1f84c-9769-4983-87e8-f9313325e533
mini:~#

RAID への追加

mini:~# mdadm -a /dev/md0 /dev/sda1
md: bind<sda1>
RAID1 conf printout:
 --- wd:1 rd:2
 disk 0, wo:0, o:1, dev:sdb1
 disk 1, wo:1, o:1, dev:sda1
md: syncing RAID array md0
md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
md: using maximum available idle IO bandwidth (but not more than 50000 KB/sec) for reconstruction.
md: using 128k window, over a total of 1003904 blocks.
mdadm: added /dev/sda1
mini:~# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb2[0]
      5004160 blocks [2/1] [U_]

md10 : active raid1 sdb5[1]
      1003904 blocks [2/1] [_U]

md0 : active raid1 sda1[2] sdb1[0]
      1003904 blocks [2/1] [U_]
      [=========>...........]  recovery = 49.3% (495616/1003904) finish=0.1min speed=49703K/sec

unused devices: <none>
mini:~# md: md0: sync done.
RAID1 conf printout:
 --- wd:2 rd:2
 disk 0, wo:0, o:1, dev:sdb1
 disk 1, wo:0, o:1, dev:sda1

mini:~# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb2[0]
      5004160 blocks [2/1] [U_]

md10 : active raid1 sdb5[1]
      1003904 blocks [2/1] [_U]

md0 : active raid1 sda1[1] sdb1[0]
      1003904 blocks [2/2] [UU]

unused devices: <none>
mini:~# mdadm -a /dev/md1 /dev/sda2
md: bind<sda2>
RAID1 conf printout:
 --- wd:1 rd:2
 disk 0, wo:0, o:1, dev:sdb2
 disk 1, wo:1, o:1, dev:sda2
md: syncing RAID array md1
md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
md: using maximum available idle IO bandwidth (but not more than 50000 KB/sec) for reconstruction.
md: using 128k window, over a total of 5004160 blocks.
mdadm: added /dev/sda2
mini:~# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sda2[2] sdb2[0]
      5004160 blocks [2/1] [U_]
      [======>..............]  recovery = 30.0% (1502336/5004160) finish=1.2min speed=48488K/sec

md10 : active raid1 sdb5[1]
      1003904 blocks [2/1] [_U]

md0 : active raid1 sda1[1] sdb1[0]
      1003904 blocks [2/2] [UU]

unused devices: <none>
mini:~# md: md1: sync done.
RAID1 conf printout:
 --- wd:2 rd:2
 disk 0, wo:0, o:1, dev:sdb2
 disk 1, wo:0, o:1, dev:sda2
cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sda2[1] sdb2[0]
      5004160 blocks [2/2] [UU]

md10 : active raid1 sdb5[1]
      1003904 blocks [2/1] [_U]

md0 : active raid1 sda1[1] sdb1[0]
      1003904 blocks [2/2] [UU]

unused devices: <none>
mini:~# mdadm -a /dev/md10 /dev/sda5
md: bind<sda5>
RAID1 conf printout:
 --- wd:1 rd:2
 disk 0, wo:1, o:1, dev:sda5
 disk 1, wo:0, o:1, dev:sdb5
md: syncing RAID array md10
md: minimum _guaranteed_ reconstruction speed: 1000 KB/sec/disc.
md: using maximum available idle IO bandwidth (but not more than 50000 KB/sec) for reconstruction.
md: using 128k window, over a total of 1003904 blocks.
mdadm: added /dev/sda5
mini:~# md: md10: sync done.
RAID1 conf printout:
 --- wd:2 rd:2
 disk 0, wo:0, o:1, dev:sda5
 disk 1, wo:0, o:1, dev:sdb5

mini:~# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sda2[1] sdb2[0]
      5004160 blocks [2/2] [UU]

md10 : active raid1 sda5[0] sdb5[1]
      1003904 blocks [2/2] [UU]

md0 : active raid1 sda1[1] sdb1[0]
      1003904 blocks [2/2] [UU]

unused devices: <none>
mini:~#
できた。

再起動

念のため再起動してちゃんと動作するか確認。
mini:~# shutdown -r now
INIT: Switching to runlevel: 6
INIT: Sending proStopping periodic command scheduler: crond.
Stopping MTA: exim4_listener.
Stopping internet superserver: inetd.
	:
	:
Debian GNU/Linux 4.0 mini ttyS0

mini login: 
ちゃんと立ち上がってきた。
Debian GNU/Linux 4.0 mini ttyS0

mini login: root
Password:
Last login: Thu Nov  1 01:04:47 2007 on ttyS0
Linux mini 2.6.16.16-arm1 #316 Tue Jul 22 16:22:33 JST 2008 armv5tejl

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
mini:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4993920    228880   4765040   5% /
tmpfs                    63116         0     63116   0% /lib/init/rw
tmpfs                    63116         0     63116   0% /dev/shm
/dev/root.old            15351     13874      1477  91% /initrd
/dev/md0                988088    149348    788548  16% /boot
mini:~# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb2[0] sda2[1]
      5004160 blocks [2/2] [UU]

md10 : active raid1 sda5[0] sdb5[1]
      1003904 blocks [2/2] [UU]

md0 : active raid1 sdb1[0] sda1[1]
      1003904 blocks [2/2] [UU]

unused devices: 
mini:~# free
             total       used       free     shared    buffers     cached
Mem:        126236      37048      89188          0      16412      12744
-/+ buffers/cache:       7892     118344
Swap:      1003896          0    1003896
mini:~#
md0, md1, md10 全部動いている。
無駄な回り道だった

LS-WSGL debian 化の残課題まとめ

1.debian がまともに動くようにする

1)起動時のエラーつぶし
(1)md0 の起動時マウント
・ネットワークの設定
・パッケージリストのアップデート
・mdadm のインストール
2)標準ファームによる RAID 化(md0, md1, md10)
3)電源スイッチによる電源OFF実現
4)LED の点滅解除
5)パッケージのアップデート
6)swap の有効化
7)標準ファームのジェイル化
7)HDD の標準ファームでジェイル化
8)カーネルモジュールのロード
9)シャットダウン時のエラーつぶし

2.手順化、ハックキット化

要る?

1)シリアルコンソールを使わないインストール方法の検討
2)インストーラ作成



LinkStation Mini
LS-WSGL
楽天市場
Amazon
Yahoo!ショッピング
Livedoor デパート
Sofmap
TSUKUMO ネットショップ
ムラウチドットコム
ヤマダ電機WEB
パソQ


debian 化(22)sda の作り直し
ハックの記録
LinkStation/玄箱 をハックしよう

debian 化(24)HDD の標準ファームをジェイル化

Copyright (C) 2003-2008 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市