標準ファーム入り HDD の作成

LS-XHL

自分で標準ファーム入り HDD を作ってみる。
parted でパーティションを作るのは初めて。

標準ファームのパーティション

EM モードからインストールした WD1600 のパーティションを メモっておく。
root@LS-XHLA1F:~# parted
GNU Parted 1.8.8
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: WDC WD1600JS-00NCB1 (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB  xfs          primary
 3      6144MB  6144MB  512B                 primary
 4      6144MB  6144MB  512B                 primary
 5      6144MB  7168MB  1024MB  linux-swap   primary
 6      7168MB  152GB   145GB   xfs          primary

(parted) quit
root@LS-XHLA1F:~#

HDD の接続

オリジナルの HITACH Deskstar を USB で接続する。
root@LS-XHLA1F:~# tail -f /var/log/messages
	:
	:
Nov  1 00:05:39 LS-XHLA1F kernel: usb 1-1: new high speed USB device using ehci_marvell and address 2
Nov  1 00:05:39 LS-XHLA1F kernel: usb 1-1: configuration #1 chosen from 1 choice
Nov  1 00:05:39 LS-XHLA1F kernel: scsi2 : SCSI emulation for USB Mass Storage devices
Nov  1 00:05:40 LS-XHLA1F getty[4087]: can't open 'ttyS0': No such device or address^M
Nov  1 00:05:44 LS-XHLA1F kernel: scsi 2:0:0:0: Direct-Access     Hitachi    GEC534RF37924E A5CA PQ: 0 ANSI: 2 CCS
Nov  1 00:05:44 LS-XHLA1F kernel: sd 2:0:0:0: [sdb] 976773168 512-byte hardware sectors (500108 MB)
Nov  1 00:05:45 LS-XHLA1F kernel: sd 2:0:0:0: [sdb] Write Protect is off
Nov  1 00:05:45 LS-XHLA1F kernel: sd 2:0:0:0: [sdb] Assuming drive cache: write through
Nov  1 00:05:45 LS-XHLA1F kernel: sd 2:0:0:0: [sdb] 976773168 512-byte hardware sectors (500108 MB)
Nov  1 00:05:45 LS-XHLA1F kernel: sd 2:0:0:0: [sdb] Write Protect is off
Nov  1 00:05:45 LS-XHLA1F kernel: sd 2:0:0:0: [sdb] Assuming drive cache: write through
Nov  1 00:05:45 LS-XHLA1F kernel:  sdb: sdb1 sdb2 sdb4 < sdb5 sdb6 >
Nov  1 00:05:45 LS-XHLA1F kernel: sd 2:0:0:0: [sdb] Attached SCSI disk
Nov  1 00:05:45 LS-XHLA1F kernel: sd 2:0:0:0: Attached scsi generic sg1 type 0
Nov  1 00:05:45 LS-XHLA1F kernel: FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
Nov  1 00:05:45 LS-XHLA1F kernel: kjournald starting.  Commit interval 5 seconds
Nov  1 00:05:45 LS-XHLA1F kernel: EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
Nov  1 00:05:45 LS-XHLA1F kernel: EXT3 FS on sdb1, internal journal
Nov  1 00:05:45 LS-XHLA1F kernel: EXT3-fs: mounted filesystem with ordered data mode.
Nov  1 00:05:49 LS-XHLA1F nmbd[1204]: [2007/11/01 00:05:49, 0] nmbd/nmbd.c:terminate(58)
Nov  1 00:05:49 LS-XHLA1F nmbd[1204]:   Got SIGTERM: going down...
Nov  1 00:05:50 LS-XHLA1F getty[4766]: can't open 'ttyS0': No such device or address^M
Nov  1 00:06:00 LS-XHLA1F getty[5332]: can't open 'ttyS0': No such device or address^M
Nov  1 00:06:02 LS-XHLA1F mt-daapd[5410]: Starting rendezvous daemon
Nov  1 00:06:02 LS-XHLA1F mt-daapd[5412]: Starting signal handler
Nov  1 00:06:02 LS-XHLA1F mt-daapd[5412]: Loading playlists
Nov  1 00:06:02 LS-XHLA1F mt-daapd[5412]: Initializing database
Nov  1 00:06:02 LS-XHLA1F mt-daapd[5412]: Starting mp3 scan
Nov  1 00:06:02 LS-XHLA1F mt-daapd[5412]: Starting web server from /usr/local/share/mt-daapd/admin-root on port 3689
Nov  1 00:06:02 LS-XHLA1F mt-daapd[5412]: Registering rendezvous names
Nov  1 00:06:02 LS-XHLA1F mt-daapd[5412]: Scanned 0 songs in  0 seconds
	:
	:
getty がうるさい。

parted の起動

root@LS-XHLA1F:~# parted /dev/sdb
GNU Parted 1.8.8
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
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  500GB   494GB   extended
 5      6153MB  7181MB  1028MB  logical   linux-swap
 6      7181MB  499GB   492GB   logical   xfs

(parted)
先日 LS-QL でフォーマットしたのでパーティションが残っている。

パーティションを消す

どうやって消すの?
(parted) help
	:
	:
  rm NUMBER                                delete partition NUMBER
	:
	:
(parted)
rm か。
(parted) rm 6
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
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  500GB   494GB   extended
 5      6153MB  7181MB  1028MB  logical   linux-swap

(parted)
消えた。全部消す。
(parted) rm 5
(parted) rm 4
(parted) rm 2
(parted) rm 1
Error: Partition /dev/sdb1 is being used. You must unmount it before you modify
it with Parted.
(parted)
あーあ。自動マウントか。やり直し。

やり直し

(parted) quit
Information: You may need to update /etc/fstab.

root@LS-XHLA1F:~# mount
rootfs on / type rootfs (rw)
/dev/root on / type xfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw)
/dev/ram1 on /mnt/ram type tmpfs (rw)
/dev/sda1 on /boot type ext3 (rw,data=ordered)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/disk1_6 on /mnt/disk1 type xfs (rw,noatime,usrquota,grpquota)
/dev/usbdisk1_1 on /mnt/usbdisk1 type ext3 (rw,noatime,data=ordered)
root@LS-XHLA1F:~# umount /mnt/usbdisk1/
root@LS-XHLA1F:~# parted /dev/sdb
GNU Parted 1.8.8
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      32.3kB  1028MB  1028MB  primary  ext3

(parted) 
quit でも更新されてるんや。こわ。
消す。
(parted) rm 1
(parted)

パーティションテーブルの作成

最初に mklabel を実行するそうな。
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on
this disk will be lost. Do you want to continue?
parted: invalid token: gpt
Yes/No? y
New disk label type?  [msdos]? gpt
(parted)

パーティションの作成

とりあえず作ってみる
(parted) mkpart
Partition name?  []? primary
File system type?  [ext2]? ext3
Start? 17.4kB
End? 1024MB
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB               primary

(parted)
File system が ext3 にならない。mkfs しないといけない?

sdb1 のフォーマット

parted を終わって /dev/sdb1 をフォーマットしてみる。
(parted) quit
Information: You may need to update /etc/fstab.


root@LS-XHLA1F:~# mke2fs -j /dev/sdb1
mke2fs 1.40.5 (27-Jan-2008)
Warning: 256-byte inodes not usable on older systems
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
62592 inodes, 249995 blocks
12499 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
7824 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 20 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@LS-XHLA1F:~#
File system はどうなった?
root@LS-XHLA1F:~# parted /dev/sdb
GNU Parted 1.8.8
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary

(parted)
ext3 になった。よし。

残りのパーティションの作成

残りも作る
(parted) mkpart
Partition name?  []? primary
File system type?  [ext2]? xfs
Start? 1024MB
End? 6144MB
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB               primary

(parted) mkpart
Partition name?  []? primary
File system type?  [ext2]?
Start? 6144MB
End? 6144MB
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB               primary
 3      6144MB  6144MB  512B                 primary

(parted) mkpart
Partition name?  []? primary
File system type?  [ext2]?
Start? 6144MB
End? 6144MB
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB               primary
 3      6144MB  6144MB  512B                 primary
 4      6144MB  6144MB  512B                 primary

(parted) mkpart
Partition name?  []? primary
File system type?  [ext2]? linux-swap
Start? 6144MB
End? 7168MB
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB               primary
 3      6144MB  6144MB  512B                 primary
 4      6144MB  6144MB  512B                 primary
 5      6144MB  7168MB  1024MB               primary

(parted)
いよいよ最後だが、困った、残り全部はどうすればいいの?
(parted) mkpart
Partition name?  []? primary
File system type?  [ext2]? xfs
Start? 7168MB
End?
End? 500GB
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB               primary
 3      6144MB  6144MB  512B                 primary
 4      6144MB  6144MB  512B                 primary
 5      6144MB  7168MB  1024MB               primary
 6      7168MB  500GB   493GB                primary

(parted)
Enter だけでは駄目だった。

確認

parted を終了、もう一度起動して確認
(parted) quit
Information: You may need to update /etc/fstab.

root@LS-XHLA1F:~# parted /dev/sdb
GNU Parted 1.8.8
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB               primary
 3      6144MB  6144MB  512B                 primary
 4      6144MB  6144MB  512B                 primary
 5      6144MB  7168MB  1024MB               primary
 6      7168MB  500GB   493GB                primary

(parted) quit
root@LS-XHLA1F:~#
OK

フォーマット

sdb2 を xfs にフォーマットする
root@LS-XHLA1F:~# mkfs.xfs /dev/sdb2
meta-data=/dev/sdb2              isize=256    agcount=8, agsize=156250 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=1250000, 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, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
root@LS-XHLA1F:~# parted /dev/sdb
GNU Parted 1.8.8
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB  xfs          primary
 3      6144MB  6144MB  512B                 primary
 4      6144MB  6144MB  512B                 primary
 5      6144MB  7168MB  1024MB               primary
 6      7168MB  500GB   493GB                primary

(parted) quit
root@LS-XHLA1F:~#
続いて sdb5 を swap に
root@LS-XHLA1F:~# mkswap /dev/sdb5
Setting up swapspace version 1, size = 1023994880 bytes
root@LS-XHLA1F:~#
sdb6 を xfs に
root@LS-XHLA1F:~# mkfs.xfs /dev/sdb6
meta-data=/dev/sdb6              isize=256    agcount=16, agsize=7521665 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=120346640, 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, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
root@LS-XHLA1F:~# parted -l
Model: WDC WD1600JS-00NCB1 (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB  xfs          primary
 3      6144MB  6144MB  512B                 primary
 4      6144MB  6144MB  512B                 primary
 5      6144MB  7168MB  1024MB  linux-swap   primary
 6      7168MB  152GB   145GB   xfs          primary


Model: Hitachi  GEC534RF37924E (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  1024MB  1024MB  ext3         primary
 2      1024MB  6144MB  5120MB  xfs          primary
 3      6144MB  6144MB  512B                 primary
 4      6144MB  6144MB  512B                 primary
 5      6144MB  7168MB  1024MB  linux-swap   primary
 6      7168MB  500GB   493GB   xfs          primary


Error: /dev/md0: unrecognised disk label

Error: /dev/mtdblock0: unrecognised disk label

root@LS-XHLA1F:~#
行けたっぽい

マウント

いつもと違って(?)/z にマウントする。
root@LS-XHLA1F:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              4989760    336236   4653524   7% /
/dev/ram1                15360       116     15244   1% /mnt/ram
/dev/sda1               992036    136000    856036  14% /boot
/dev/disk1_6         141368380       612 141367768   0% /mnt/disk1
root@LS-XHLA1F:~# ls /
bin             etc             lighttpd.webui  root            tmp
boot            home            mnt             sbin            usr
debugtool       initrd          modules         share           var
dev             lib             proc            sys             www
root@LS-XHLA1F:~# mkdir /z
root@LS-XHLA1F:~# mount /dev/sdb2 /z
root@LS-XHLA1F:~# mkdir /z/boot
root@LS-XHLA1F:~# mount /dev/sdb1 /z/boot
root@LS-XHLA1F:~# mkdir -p /z/mnt/disk1
root@LS-XHLA1F:~# mount /dev/sdb6 /z/mnt/disk1
root@LS-XHLA1F:~#

標準ファームのコピー

root@LS-XHLA1F:/# ls
bin             etc             lighttpd.webui  root            tmp             z
boot            home            mnt             sbin            usr
debugtool       initrd          modules         share           var
dev             lib             proc            sys             www
root@LS-XHLA1F:/# tar cf - b* d* e* h* i* l* m* r* sbin share t* u* v* w* |(cd z; tar xvf -)
	:
	:
root@LS-XHLA1F:/# mkdir /z/proc
root@LS-XHLA1F:/# mkdir /z/sys
root@LS-XHLA1F:/# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              4989760    335908   4653852   7% /
/dev/ram1                15360       116     15244   1% /mnt/ram
/dev/sda1               992036    136000    856036  14% /boot
/dev/disk1_6         141368380       612 141367768   0% /mnt/disk1
/dev/sdb2              4989760    336020   4653740   7% /z
/dev/sdb1               984228    136016    798216  15% /z/boot
/dev/sdb6            481255488       636 481254852   0% /z/mnt/disk1
root@LS-XHLA1F:/# 
相変わらずちょっと違う。

再起動

電源 SW で電源 OFF、
AC アダプタを抜いて、
SATA で接続していた WD1600 をはずし、
USB で接続していた HD103UJ を SATA で接続、
AC アダプタを刺して、
電源 SW で電源 ON

LED が真っ赤に E06 を示した。
なんで?
なんかトラップがあるの?
こういうときにシリアルコンソールがあれば、 なんか手がかりが得られるのに。。。



LS-XHL
バッファローダイレクト
楽天市場
amazon
Sofmap
ValuMore


ファームウェア 1.05 のインストール
ハックの記録
LinkStation/玄箱 をハックしよう

lighttpd

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