HDD の増設

Debian LS-QL

なぜか 1TB の HDD が放置状態だったので、 第三世代 LinkStation ハックキットで Debian 化した LS-QL に 増設することにする。
LS-QL の RAID の操作なんて、もうすっかり忘れている。。。。

現状

qube:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4993920    273676   4720244   6% /
tmpfs                    62888         0     62888   0% /lib/init/rw
tmpfs                    62888         0     62888   0% /dev/shm
/dev/root.old            31729     16849     14880  54% /initrd
/dev/md0                995928    179480    816448  19% /boot
/dev/sda6            236216764     70400 236146364   1% /mnt/disk1
qube:~# parted -s /dev/sda print
Model: SAMSUNG HD250HJ (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  1028MB  1028MB  primary   ext3
 2      1028MB  6153MB  5124MB  primary   xfs
 4      6153MB  250GB   244GB   extended
 5      6153MB  7181MB  1028MB  logical   linux-swap
 6      7181MB  249GB   242GB   logical   xfs

qube:~#
SUMSUNG の HD250HJ が1台だけ装着されている状態。

パーティションの確認

増設する 1TB HDD WD10EADS のパーティションがどうなっているかを見るために、 USB で LS-QL に接続する。
qube:~# tail -f /var/log/messages
	:
	:
Dec 14 21:58:54 qube kernel: usb 1-1: new high speed USB device using ehci_marvell and address 9
Dec 14 21:58:55 qube kernel: usb 1-1: configuration #1 chosen from 1 choice
Dec 14 21:58:55 qube kernel: scsi7 : SCSI emulation for USB Mass Storage devices
Dec 14 21:59:00 qube kernel: scsi 7:0:0:0: Direct-Access     WDC WD10  WD-WCAV52628997 0A01 PQ: 0 ANSI: 2 CCS
Dec 14 21:59:00 qube kernel: sd 7:0:0:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB)
Dec 14 21:59:00 qube kernel: sd 7:0:0:0: [sdb] Write Protect is off
Dec 14 21:59:00 qube kernel: sd 7:0:0:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB)
Dec 14 21:59:00 qube kernel: sd 7:0:0:0: [sdb] Write Protect is off
Dec 14 21:59:00 qube kernel: sdb: sdb1 sdb2 sdb3 sdb4
Dec 14 21:59:00 qube kernel: sd 7:0:0:0: [sdb] Attached SCSI disk
Dec 14 21:59:00 qube kernel: sd 7:0:0:0: Attached scsi generic sg1 type 0
何で、address 9 かはさておき、sdb として認識され、 パーティションも4つある。

パーティションを見る。

qube:~# fdisk -l /dev/sdb

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x24c89b87

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          25      200781   83  Linux
/dev/sdb2              26         524     4008217+  83  Linux
/dev/sdb3             525         556      257040   82  Linux swap / Solaris
/dev/sdb4             557      121601   972293962+  83  Linux
qube:~#
fdisk で作ったパーティションなので、要らない。
消す。
qube:~# fdisk /dev/sdb

The number of cylinders for this disk is set to 121601.
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): d
Partition number (1-4): 4

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

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: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x24c89b87

   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.
qube:~#

LS-QL をシャットダウン

WD10EADS をマウンタにセットしてスロット2にセット

LS-QL の電源 ON

認識の確認

qube:~# dmesg|less
	:
	:
Intergrated Sata device found
scsi0 : Marvell SCSI to SATA adapter
scsi1 : Marvell SCSI to SATA adapter
scsi 0:0:0:0: Direct-Access     SAMSUNG  HD250HJ          FH10 PQ: 0 ANSI: 5
scsi 0:0:1:0: Direct-Access     WDC      WD10EADS-00M2B0  01.0 PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 488397168 512-byte hardware sectors (250059 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 23 00 10 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
sd 0:0:0:0: [sda] 488397168 512-byte hardware sectors (250059 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 23 00 10 00
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
 sda: sda1 sda2 sda4 < sda5 sda6 >
sd 0:0:0:0: [sda] Attached SCSI disk
sd 0:0:1:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB)
sd 0:0:1:0: [sdb] Write Protect is off
sd 0:0:1:0: [sdb] Mode Sense: 23 00 10 00
sd 0:0:1:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
sd 0:0:1:0: [sdb] 1953525168 512-byte hardware sectors (1000205 MB)
sd 0:0:1:0: [sdb] Write Protect is off
sd 0:0:1:0: [sdb] Mode Sense: 23 00 10 00
sd 0:0:1:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO and FUA
 sdb:
sd 0:0:1:0: [sdb] Attached SCSI disk
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 0:0:1:0: Attached scsi generic sg1 type 0
	:
	:
無事 sdb として認識されている。

ディスクラベルの書込み

GPT にしないといけないと思ったけど、、、
qube:~# parted -s /dev/sda print
Model: SAMSUNG HD250HJ (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  1028MB  1028MB  primary   ext3
 2      1028MB  6153MB  5124MB  primary   xfs
 4      6153MB  250GB   244GB   extended
 5      6153MB  7181MB  1028MB  logical   linux-swap
 6      7181MB  249GB   242GB   logical   xfs

qube:~#
sda は msdos だぁ。。
qube:~# parted -s /dev/sdb print
Model: WDC WD10EADS-00M2B0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End  Size  Type  File system  Flags

qube:~#
sdb も msdos なので、そのままにしておく。いいのか???

パーティションを切る

parted -s /dev/sdb mkpart primary ext3 0 1028M とかして パーティションを切っていこうと思ったのだが、 確か標準ファームにパーティションを切るスクリプトがあるはず。

ごそごそ

/initrd/usr/local/bin/libbuffalo_bin create_partition /dev/sdb
を実行すればできそう。
やってみる。

qube:~# cd /initrd/usr/local/bin/
qube:/initrd/usr/local/bin# ./libbuffalo_bin create_partition /dev/sdb
./libbuffalo_bin: error while loading shared libraries: libbuffalo_bin.so.1: cannot open shared object file: No such file or directory
qube:/initrd/usr/local/bin#
共有ライブラリがないと言われる。

chroot してやってみる。

qube:/initrd/usr/local/bin# chroot /initrd/
qube:/# /usr/local/bin/libbuffalo_bin create_partition /dev/sdb
grep_file:file /proc/partitions open fail.
/dev/sdb total sectors=0 bytes=0 0[GB}
device[/dev/sdb] access fail.
qube:/#
/proc がないと言われたので、/proc をマウント
qube:/# mount /proc
qube:/#
再実行
qube:/# /usr/local/bin/libbuffalo_bin create_partition /dev/sdb
/dev/sdb total sectors=976762584 bytes=1000204886016 931[GB}
1024+0 records in
1024+0 records out
sectors=1953525168 1000[GB] 0
usersize=992[GB]qube:/# parted -s /dev/sdb print
bash: parted: command not found
qube:/# exit
exit
qube:/initrd/usr/local/bin# parted -s /dev/sdb print
Model: WDC WD10EADS-00M2B0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  1028MB  1028MB  primary
 2      1028MB  6153MB  5124MB  primary
 4      6153MB  1000GB  994GB   extended
 5      6153MB  7181MB  1028MB  logical
 6      7181MB  999GB   992GB   logical

qube:/initrd/usr/local/bin# cd
qube:~# 
できた!

フォーマット

多分フォーマットする必要はないのだが、、、

sdb1 を ext3 に

qube:~# mke2fs -j /dev/sdb1
mke2fs 1.41.3 (12-Oct-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
62848 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
7856 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 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
qube:~# 
sdb2 を xfs に
qube:~# mkfs.xfs /dev/sdb2
meta-data=/dev/sdb2              isize=256    agcount=4, agsize=312766 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=1251061, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
qube:~# 
sdb5 を swap に
qube:~# mkswap /dev/sdb5
Setting up swapspace version 1, size = 1028120 kB
no label, UUID=d2dc79a0-f874-4710-8f59-8836a0c09e73
qube:~# 
sdb6 を xfs に。これは要る
qube:~# mkfs.xfs /dev/sdb6
meta-data=/dev/sdb6              isize=256    agcount=4, agsize=60547477 blks
         =                       sectsz=512   attr=2
data     =                       bsize=4096   blocks=242189907, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=32768, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
qube:~# 
結果を見る
qube:~# parted -s /dev/sdb print
Model: WDC WD10EADS-00M2B0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      32.3kB  1028MB  1028MB  primary   ext3
 2      1028MB  6153MB  5124MB  primary   xfs
 4      6153MB  1000GB  994GB   extended
 5      6153MB  7181MB  1028MB  logical   linux-swap
 6      7181MB  999GB   992GB   logical   xfs

qube:~# 

mdadm のインストール

mdadm で md に sdb を追加しようとしたら、、
qube:~# mdadm
-su: mdadm: command not found
qube:~# man mdadm
No manual entry for mdadm
qube:~# 
mdadm をインストールする。

インストールするパッケージは、、、

qube:~# apt-cache search mdadm
mdadm - tool to administer Linux MD arrays (software RAID)
qube:~# 
そのまま、mdadm。インストールする。
qube:~# apt-get install mdadm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  bsd-mailx exim4 exim4-base exim4-config exim4-daemon-light liblockfile1
  libpcre3 mailx
Suggested packages:
  mail-reader eximon4 exim4-doc-html exim4-doc-info gnutls-bin openssl file
  libmail-spf-query-perl swaks
The following NEW packages will be installed:
  bsd-mailx exim4 exim4-base exim4-config exim4-daemon-light liblockfile1
  libpcre3 mailx mdadm
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 2456kB of archives.
After this operation, 5390kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.jp.debian.org lenny/main libpcre3 7.6-2.1 [213kB]
Get:2 http://ftp.jp.debian.org lenny/main liblockfile1 1.08-3 [18.1kB]
Get:3 http://ftp.jp.debian.org lenny/main bsd-mailx 8.1.2-0.20071201cvs-3 [158kB]
Get:4 http://ftp.jp.debian.org lenny/main mdadm 2.6.7.2-3 [278kB]
Get:5 http://ftp.jp.debian.org lenny/main mailx 1:20071201-3 [8260B]
Get:6 http://security.debian.org lenny/updates/main exim4-config 4.69-9+lenny1 [348kB]
Get:7 http://security.debian.org lenny/updates/main exim4-base 4.69-9+lenny1 [991kB]
Get:8 http://security.debian.org lenny/updates/main exim4-daemon-light 4.69-9+lenny1 [435kB]
Get:9 http://security.debian.org lenny/updates/main exim4 4.69-9+lenny1 [7456B]
Fetched 2456kB in 6s (383kB/s)

Preconfiguring packages ...
Selecting previously deselected package exim4-config.
(Reading database ... 10078 files and directories currently installed.)
Unpacking exim4-config (from .../exim4-config_4.69-9+lenny1_all.deb) ...
Selecting previously deselected package exim4-base.
Unpacking exim4-base (from .../exim4-base_4.69-9+lenny1_armel.deb) ...
Selecting previously deselected package libpcre3.
Unpacking libpcre3 (from .../libpcre3_7.6-2.1_armel.deb) ...
Selecting previously deselected package exim4-daemon-light.
Unpacking exim4-daemon-light (from .../exim4-daemon-light_4.69-9+lenny1_armel.deb) ...
Selecting previously deselected package exim4.
Unpacking exim4 (from .../exim4_4.69-9+lenny1_all.deb) ...
Selecting previously deselected package liblockfile1.
Unpacking liblockfile1 (from .../liblockfile1_1.08-3_armel.deb) ...
Selecting previously deselected package bsd-mailx.
Unpacking bsd-mailx (from .../bsd-mailx_8.1.2-0.20071201cvs-3_armel.deb) ...
Selecting previously deselected package mdadm.
Unpacking mdadm (from .../mdadm_2.6.7.2-3_armel.deb) ...
Selecting previously deselected package mailx.
Unpacking mailx (from .../mailx_1%3a20071201-3_all.deb) ...
Processing triggers for man-db ...
Setting up exim4-config (4.69-9+lenny1) ...
Adding system-user for exim (v4)
Setting up exim4-base (4.69-9+lenny1) ...
Setting up libpcre3 (7.6-2.1) ...
Setting up exim4-daemon-light (4.69-9+lenny1) ...
Starting MTA: exim4.
Setting up exim4 (4.69-9+lenny1) ...
Setting up liblockfile1 (1.08-3) ...
Setting up bsd-mailx (8.1.2-0.20071201cvs-3) ...
Setting up mdadm (2.6.7.2-3) ...
Generating array device nodes... /var/lib/dpkg/info/mdadm.postinst: line 27: /dev/MAKEDEV: No such file or directory
failed.
Generating mdadm.conf... done.
Starting MD monitoring service: mdadm --monitor.
Generating udev events for MD arrays...done.
Setting up mailx (1:20071201-3) ...
qube:~# 
で、どうするんだっけ???ごそごそ

アレイへの追加

/dev/sdb1, sdb2 sdb5 をそれぞれ md0, md1 md10 に追加する。
qube:~# mdadm -a /dev/md0 /dev/sdb1
mdadm: added /dev/sdb1
qube:~# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sda2[1]
      5004160 blocks [4/1] [_U__]

md10 : active raid1 sda5[1]
      1003904 blocks [4/1] [_U__]

md0 : active raid1 sdb1[4] sda1[1]
      1003904 blocks [4/1] [_U__]
      [=====>...............]  recovery = 25.8% (260672/1003904) finish=0.2min speed=43435K/sec

unused devices: <none>
qube:~#
しばらくして、
qube:~# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sda2[1]
      5004160 blocks [4/1] [_U__]

md10 : active raid1 sda5[1]
      1003904 blocks [4/1] [_U__]

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

unused devices: <none>
qube:~#
続いて、sdb2 を md1 に追加する。
qube:~# mdadm -a /dev/md1 /dev/sdb2
mdadm: added /dev/sdb2
qube:~# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sdb2[4] sda2[1]
      5004160 blocks [4/1] [_U__]
      [>....................]  recovery =  3.9% (200064/5004160) finish=1.9min speed=40397K/sec

md10 : active raid1 sda5[1]
      1003904 blocks [4/1] [_U__]

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

unused devices: <none>
qube:~#
完了を待たずに、次は、sdb5 を md10 に追加する。
qube:~# mdadm -a /dev/md10 /dev/sdb5
mdadm: added /dev/sdb5
qube:~# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sdb2[4] sda2[1]
      5004160 blocks [4/1] [_U__]
      [=============>.......]  recovery = 68.6% (3438272/5004160) finish=0.5min speed=48639K/sec

md10 : active raid1 sdb5[4] sda5[1]
      1003904 blocks [4/1] [_U__]
        resync=DELAYED

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

unused devices: <none>
qube:~#
しばらく待つ。
qube:~# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sdb2[0] sda2[1]
      5004160 blocks [4/2] [UU__]

md10 : active raid1 sdb5[4] sda5[1]
      1003904 blocks [4/1] [_U__]
      [============>........]  recovery = 64.6% (650112/1003904) finish=0.1min speed=50009K/sec

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

unused devices: <none>
qube:~#
さらにしばらくして、、
qube:~# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sdb2[0] sda2[1]
      5004160 blocks [4/2] [UU__]

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

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

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

再起動

念のため、再起動する
qube:~# shutdown -r now

Broadcast message from root@qube (pts/0) (Tue Dec 14 22:52:59 2010):

The system is going down for reboot NOW!
qube:~#

確認

Debian GNU/Linux 5.0
qube login: yasunari
Password:
Last login: Tue Dec 14 22:09:46 JST 2010 from x31l.yamasita.jp on pts/0
Linux qube 2.6.22.7 #1 Thu Jun 18 21:48:29 JST 2009 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.
yasunari@qube:~$ cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md1 : active raid1 sdb2[0] sda2[1]
      5004160 blocks [4/2] [UU__]

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

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

unused devices: <none>
yasunari@qube:~$
OK!

/dev/sdb6 のマウント

データ領域の /dev/sdb6 を /mnt/disk2 にマウントする。

まず、fstab の修正

qube:~# vi /etc/fstab
	:
	:
qube:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
#                                
/dev/md1        /               xfs     defaults,noatime                0 0
proc            /proc           proc    defaults                        0 0
/dev/md10       swap            swap    defaults                        0 0
/dev/md0        /boot           ext3    defaults,noatime                0 0
/dev/sda6       /mnt/disk1      xfs     defaults,noatime                0 0
/dev/sdb6       /mnt/disk2      xfs     defaults,noatime                0 0
qube:~#
最終行を追加。

続いて、マウントポイントを作成。

qube:~# mkdir /mnt/disk2
mkdir: cannot create directory `/mnt/disk2': File exists
qube:~# ls /mnt
disk1  disk2  share
qube:~#
あれ?ある。

マウントする。

qube:~# mount /mnt/disk2/
qube:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md1               4993920    280740   4713180   6% /
tmpfs                    62888         0     62888   0% /lib/init/rw
tmpfs                    62888         0     62888   0% /dev/shm
/dev/root.old            31729     16849     14880  54% /initrd
/dev/md0                995928    179480    816448  19% /boot
/dev/sda6            236216764     70400 236146364   1% /mnt/disk1
/dev/sdb6            968628556       160 968628396   1% /mnt/disk2
qube:~#
だーん

LS-QL
バッファローダイレクト
楽天市場
amazon
livedoorデパート
Sofmap
バリューモア
Yahoo!ショッピングトップ
ムラウチドットコム


散歩
ハックの記録
LinkStation/玄箱 をハックしよう

ハックキットのインストール

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