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

LS-XHL

自分で作った標準ファーム入りの HDD から起動しない原因が分かったので、 検証のためもう一回作り直す。

起動

WD1600 から起動し、Deskstar は USB で接続する。
sdb1 が自動マウントされるので、アンマウントする。
root@LS-XHLA1F:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              4989760    336360   4653400   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/usbdisk1_1         992036    136020    856016  14% /mnt/usbdisk1
root@LS-XHLA1F:~# umount /mnt/usbdisk1/
root@LS-XHLA1F:~#

パーティションの削除

root@LS-XHLA1F:~# parted -s /dev/sdb 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  linux-swap   primary
 6      7168MB  492GB   485GB   xfs          primary

root@LS-XHLA1F:~#
標準ファームのインストーラが作ったパーティションがあるので、消す。
今日は(インタラクティブではなく)全部コマンドラインから操作してみる。
root@LS-XHLA1F:~# parted -s /dev/sdb rm 6
root@LS-XHLA1F:~# parted -s /dev/sdb rm 5
root@LS-XHLA1F:~# parted -s /dev/sdb rm 4
root@LS-XHLA1F:~# parted -s /dev/sdb rm 3
root@LS-XHLA1F:~# parted -s /dev/sdb rm 2
root@LS-XHLA1F:~# parted -s /dev/sdb rm 1
root@LS-XHLA1F:~# !?print
parted -s /dev/sdb 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

root@LS-XHLA1F:~#
fdisk でも消す。
root@LS-XHLA1F:~# fdisk /dev/sdb

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

   Device Boot      Start         End      Blocks  Id System
/dev/sdb1               1       60802   488386583+ ee EFI GPT

Command (m for help): d
Selected partition 1

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

Calling ioctl() to re-read partition table
root@LS-XHLA1F:~# fdisk -l /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
root@LS-XHLA1F:~#
まっさら状態。

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

最初に mklabel を実行する。
root@LS-XHLA1F:~# parted -s /dev/sdb mklabel gpt
root@LS-XHLA1F:~#

パーティションの作成

root@LS-XHLA1F:~# parted -s /dev/sdb mkpart primary ext3 17.4kB 1024M
root@LS-XHLA1F:~# parted -s /dev/sdb 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

root@LS-XHLA1F:~#
フォーマットしていないのに File system が ext3 になっている。

続ける

root@LS-XHLA1F:~# parted -s /dev/sdb mkpart primary xfs 1024MB 6144MB
root@LS-XHLA1F:~# parted -s /dev/sdb mkpart primary xfs 6144MB 6144MB
root@LS-XHLA1F:~# parted -s /dev/sdb mkpart primary xfs 6144MB 6144MB
root@LS-XHLA1F:~# parted -s /dev/sdb mkpart primary linux-swap 6144MB  7168MB
root@LS-XHLA1F:~# parted -s /dev/sdb mkpart primary xfs 7168MB 500GB
root@LS-XHLA1F:~# !?print
parted -s /dev/sdb 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  linux-swap   primary
 6      7168MB  500GB   493GB   xfs          primary

root@LS-XHLA1F:~#
できた。

フォーマット

sdb1 を ext3 にフォーマットする。 ここで天使の分け前を無しにする。
root@LS-XHLA1F:~# mkfs.ext3 -j -m 0 -I 128 /dev/sdb1
mke2fs 1.40.5 (27-Jan-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
62720 inodes, 249995 blocks
0 blocks (0.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
7840 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 23 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@LS-XHLA1F:~#
続いて sdb2 は xfs。
クリアのため ext3 にフォーマットしてから xfs に
root@LS-XHLA1F:~# mkfs.ext3 -j /dev/sdb2
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)
312624 inodes, 1250000 blocks
62500 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
8016 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 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@LS-XHLA1F:~# mkfs.xfs -f /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:~#
続いて 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.ext3 -j /dev/sdb6
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)
30089216 inodes, 120346641 blocks
6017332 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
3673 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
        102400000

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

This filesystem will be automatically checked every 24 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@LS-XHLA1F:~# mkfs.xfs -f /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:~#

マウント

前回と同じく/z にマウントする。
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:~# cd /
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    335920   4653840   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    361272   4628488   7% /z
/dev/sdb1               992036    136016    856020  14% /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

立ち上がってきた!


BUFFALO INC. LinkStation series

LS-XHLA1F login: root
No mail.
root@LS-XHLA1F:~#
root@LS-XHLA1F:~# parted -s /dev/sda print
Model: Hitachi HDP725050GLA360 (scsi)
Disk /dev/sda: 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

root@LS-XHLA1F:~#


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


ES ?
ハックの記録
LinkStation/玄箱 をハックしよう

まだまだ試行錯誤

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