HDD の玉突き交換(2)LS-LGL の HDD 交換

LS-LGL

パーティションが sda1 しかない HDD へファームウェア 2.01 を インストールしようとしたら、インストールできなかった。
今度はパーティションを切った HDD から Ramroot で起動し、 同様にインストールしてみる。

パーティションを切る

Maxtor DiamondMax をハックキット化した LS-GL に USB で接続、 パーティションを切る。
ude:~# fdisk /dev/sdb

The number of cylinders for this disk is set to 19929.
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: 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          25      200781   83  Linux

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

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

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

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

Command (m for help): p

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          25      200781   83  Linux
/dev/sdb2              26          87      498015   83  Linux
/dev/sdb4              88       19929   159380865    5  Extended
/dev/sdb5              88         104      136521   83  Linux
/dev/sdb6             105       19929   159244281   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/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          25      200781   83  Linux
/dev/sdb2              26          87      498015   83  Linux
/dev/sdb4              88       19929   159380865    5  Extended
/dev/sdb5              88         104      136521   82  Linux swap / Solaris
/dev/sdb6             105       19929   159244281   83  Linux

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

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

フォーマットする

ude:~# mkfs -j /dev/sdb1
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
50200 inodes, 200780 blocks
10039 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
25 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729

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

This filesystem will be automatically checked every 33 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
ude:~#
あちゃー。/boot までフォーマットしてしもた。
ude:~# mkfs -j /dev/sdb2
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
124928 inodes, 498012 blocks
24900 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
61 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409

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

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
ude:~# mkfs.xfs /dev/sdb2
mkfs.xfs: /dev/sdb2 appears to contain an existing filesystem (ext3).
mkfs.xfs: Use the -f option to force overwrite.
ude:~# mkfs.xfs -f /dev/sdb2
meta-data=/dev/sdb2              isize=256    agcount=8, agsize=15562 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=124496, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=1200, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0
ude:~# mkfs -j /dev/sdb6
mke2fs 1.40-WIP (14-Nov-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
19906560 inodes, 39811070 blocks
1990553 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1215 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

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

This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
ude:~# mkfs.xfs -f /dev/sdb6
meta-data=/dev/sdb6              isize=256    agcount=16, agsize=2488191 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=39811056, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=19438, version=1
         =                       sectsz=512   sunit=0 blks
realtime =none                   extsz=65536  blocks=0, rtextents=0
ude:~# mkswap /dev/sdb5
Setting up swapspace version 1, size = 139792 kB
no label, UUID=1f601787-6774-45c6-bd12-49f9a25f52e6
ude:~#

/boot のコピー

/dev/sdb1 までフォーマットしてしまったので、 もう一回 /boot をコピーする。
オリジナルの HDD のファームをアップデートしたので、 今度は、ファームウェア 2.01 の uImage.buffalo と initrd.buffalo。

まずは吸出し

ude:~# mkdir /tmp/boot
ude:~# mount /dev/sdb1 /tmp/boot
ude:~# mkdir /tmp/boot_save
ude:~# cd /tmp/boot
ude:/tmp/boot# tar cf - uImage.buffalo initrd.buffalo |(cd /tmp/boot_save/; tar xvf -)
uImage.buffalo
initrd.buffalo
ude:/tmp/boot# ls /tmp/boot_save/
initrd.buffalo  uImage.buffalo
ude:/tmp/boot# cd /
ude:/# umount /tmp/boot
ude:/#
続いて、Maxtor DiamondMax をつないでコピー
ude:/# mount /dev/sdb1 /tmp/boot
ude:/# cd /tmp/boot_save/
ude:/tmp/boot_save# ls
initrd.buffalo  uImage.buffalo
ude:/tmp/boot_save# tar cf - * |(cd /tmp/boot; tar xvf -)
initrd.buffalo
uImage.buffalo
ude:/tmp/boot_save# cd /tmp/boot
ude:/tmp/boot# ls -l
total 2736
-rw-r--r-- 1 root root 1490384 Sep  9 14:52 initrd.buffalo
drwx------ 2 root root   12288 Nov 16 14:55 lost+found
-rw-r--r-- 1 root root 1284160 Jan  1  1970 uImage.buffalo
ude:/tmp/boot# cd /
ude:/# umount /tmp/boot
ude:/#

LS-L160GL :-) 起動

DiamondMax を LS-LGL にセットして Ramroot で起動。
今度は swap のパーティションを切ったので、 swap も有効になっている。
BUFFALO INC. LinkStation series LS-LGL(SUIZEI)
LS-LGL-EMFF7 login: admin
Password:


BusyBox v1.2.2 (2006.12.26-08:28+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ free
              total         used         free       shared      buffers
  Mem:        13632         8040         5592            0         4116
 Swap:       136512            0       136512
Total:       150144         8040       142104
~ $
これだけあれば、Out of Memory にはならんでしょ。

ファームウェアのアップデート

LSUpdater.exe を実行。
LS-LGL-EMFF7 が見つかったので、「ファームウェア更新」を実行。

今度は正常にアップデートできた。

ちょっとだけ散歩

~ $ cat /etc/linkstation_release
VERSION=2.01
SUBVERSION=HDD 0.40
PRODUCTID=0x0000000B
BUILDDATE=2008/09/09 14:52:29
~ $ free
              total         used         free       shared      buffers
  Mem:        13632        12908          724            0          660
 Swap:       136512           12       136500
Total:       150144        12920       137224
~ $ ps
  PID  Uid     VmSize Stat Command
    1 root        560 S   init
    2 root            SWN [ksoftirqd/0]
    3 root            SW< [events/0]
    4 root            SW< [khelper]
    5 root            SW< [kthread]
    9 root            SW< [kblockd/0]
   32 root            SW  [pdflush]
   35 root            SW< [aio/0]
   34 root            SW  [kswapd0]
   37 root            SW< [xfslogd/0]
   38 root            SW< [xfsdatad/0]
   39 root            SW  [xfsbufd]
  162 root            SW  [scsi_eh_0]
  175 root            SW  [mtdblockd]
  221 root            SW  [pdflush]
  340 root            SW  [kjournald-sda2]
  640 root        756 S   syslogd -m 0
  644 root        480 S   klogd
  654 root        664 S   /bin/sh /usr/local/sbin/kernelmon
  662 root        664 S   /bin/sh /usr/local/sbin/FanCheckd
  716 root            SW  [kjournald-sda1]
  746 root            SW  [xfssyncd]
  841 root        496 S   cat /proc/buffalo/kernevnt
  858 root        560 S   /sbin/dhcpcd -L /etc/dhcpc -h LS-LGLFF7 -t 15 -x -y -
  960 root       2752 S   /usr/local/sbin/smbd -D
  963 root       2740 S   /usr/local/sbin/smbd -D
  964 root       1816 S   /usr/local/sbin/nmbd -D
  983 root       1948 S   /usr/local/apache/bin/httpd
  988 root       1960 S   /usr/local/apache/bin/httpd
  989 root       1960 S   /usr/local/apache/bin/httpd
  990 root       1960 S   /usr/local/apache/bin/httpd
  991 root       1960 S   /usr/local/apache/bin/httpd
 1010 root        852 S   /usr/local/sbin/clientUtil_server -i eth0
 1041 root       1968 S   /usr/local/apache/bin/httpd
 1106 root        504 S   /usr/local/sbin/logchkd
 1116 root        524 S   /usr/local/sbin/daemonwatch -a /etc/daemonwatch.list
 1125 root        804 S   /usr/sbin/crond
 1168 admin       944 S   -sh
 1192 root        416 S   sleep 60
 1196 admin       776 R   ps
~ $

Web 管理画面

httpd が動いているので、http://192.168.2.41 にアクセスしてみた。

「Webアクセス サービス設定」だけの設定画面が出てきた。

バックアップ

HDD を ハックキット化した LS-GL に USB で接続してバックアップを取る。
ude:~# mkdir /tmp/root
ude:~# mount /dev/sdb2 /tmp/root
ude:~# mount /dev/sdb1 /tmp/root/boot
ude:~# mount /dev/sdb6 /tmp/root/mnt/disk1
ude:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2              2046080    487860   1558220  24% /
tmpfs                    63076         0     63076   0% /lib/init/rw
tmpfs                    63076         0     63076   0% /dev/shm
/dev/root.old            13303     10988      2315  83% /initrd
/dev/sda1               194443     10314    174090   6% /boot
/dev/sda4            153699096   1564544 152134552   2% /mnt
/dev/sdb2               482246    153507    328739  32% /tmp/root
/dev/sdb1               194442      8547    175856   5% /tmp/root/boot
/dev/sdb6            159166472       272 159166200   1% /tmp/root/mnt/disk1
ude:~# cd /tmp/root
ude:/tmp/root# mkdir /mnt/Backup/whi
ude:/tmp/root# tar zcvf /mnt/Backup/whi/whi_081116.tar.gz .
	:
	:
ude:/tmp/root# 

telnet 可能化

ついでに telnetd の起動と root のパスワードの消去を実行。
ude:/tmp/root# ls -l usr/sbin/telnetd
lrwxrwxrwx 1 root root 17 Nov 17  2008 usr/sbin/telnetd -> ../../bin/busybox
ude:/tmp/root# ls -l etc/init.d/rcS
-rwxr-xr-x 1 root root 1259 Sep  9 11:14 etc/init.d/rcS
ude:/tmp/root# echo /usr/sbin/telnetd >> etc/init.d/rcS
ude:/tmp/root# vi etc/shadow
	:
	:
ude:/tmp/root#

アンマウント

ude:/tmp/root# cd /
ude:/# umount /tmp/root/mnt/disk1/
ude:/# umount /tmp/root/boot
ude:/# umount /tmp/root
ude:/#

一応、これで玉突き1回目完了



LS-L250GL
楽天市場
Amazon
Yahoo! ショッピング
Sofmap
TSUKUMO ネットショップ
ValuMore!
ムラウチドットコム
uWorks
パソQ


ファームウェア 2.01 へのアップデート
ハックの記録
LinkStation/玄箱 をハックしよう

手のひらサイズの小型ネットワーク対応HDD〈リンクステーション ミニ〉に、ホワイトモデルをラインナップ

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