普通のパーティションからのブート

LS-XHL

GPT でない HDD からブートするかどうかを試してみる。

HDD を USB で接続

WD1600 を USB で接続
root@LS-XHL25B:~# less /var/log/messages
	:
	:
Feb  6 14:52:13 LS-XHL25B kernel: scsi 2:0:0:0: Direct-Access     WDC WD16  WD-
WCANM4151553 2E02 PQ: 0 ANSI: 2 CCS
Feb  6 14:52:13 LS-XHL25B kernel: sd 2:0:0:0: [sdb] 312581808 512-byte hardware
 sectors (160042 MB)
Feb  6 14:52:13 LS-XHL25B kernel: sd 2:0:0:0: [sdb] Write Protect is off
Feb  6 14:52:13 LS-XHL25B kernel: sd 2:0:0:0: [sdb] Assuming drive cache: write
 through
Feb  6 14:52:13 LS-XHL25B kernel: sd 2:0:0:0: [sdb] 312581808 512-byte hardware
 sectors (160042 MB)
Feb  6 14:52:13 LS-XHL25B kernel: sd 2:0:0:0: [sdb] Write Protect is off
Feb  6 14:52:14 LS-XHL25B kernel: sd 2:0:0:0: [sdb] Assuming drive cache: write
 through
Feb  6 14:52:14 LS-XHL25B kernel:  sdb: sdb1 sdb2 sdb3 sdb4
Feb  6 14:52:14 LS-XHL25B kernel: sd 2:0:0:0: [sdb] Attached SCSI disk
Feb  6 14:52:14 LS-XHL25B kernel: sd 2:0:0:0: Attached scsi generic sg1 type 0
Feb  6 14:52:14 LS-XHL25B kernel: FAT: utf8 is not a recommended IO charset for
 FAT filesystems, filesystem will be case sensitive!
	:
sdb と認識された

アンマウント

/mnt/usbdisk1 に自動マウントされたので、 アンマウントする
root@LS-XHL25B:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              4989760    335436   4654324   7% /
/dev/ram1                15360       120     15240   1% /mnt/ram
/dev/sda1               992036    135700    856336  14% /boot
/dev/disk1_6         141368380       612 141367768   0% /mnt/disk1
/dev/usbdisk1_1         194442      7428    176975   4% /mnt/usbdisk1
root@LS-XHL25B:~# umount /mnt/usbdisk1
root@LS-XHL25B:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              4989760    335436   4654324   7% /
/dev/ram1                15360       120     15240   1% /mnt/ram
/dev/sda1               992036    135700    856336  14% /boot
/dev/disk1_6         141368380       612 141367768   0% /mnt/disk1
root@LS-XHL25B:~#

パーティションの設定

sdb にパーティションを設定する。
root@LS-XHL25B:~# fdisk /dev/sdb

The number of cylinders for this disk is set to 19457.
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: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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         281     2056320  83 Linux
/dev/sdb3             282         313      257040  82 Linux swap
/dev/sdb4             314       19457   153774180  83 Linux

Command (m for help):
まずはパーティションの削除
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: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System

Command (m for help):
パーティションを作る。
/boot 1GB!
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19457, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457): +1024M

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sdb1               1         125     1004031  83 Linux

Command (m for help):
/ 5GB
Partition number (1-4): 2
First cylinder (126-19457, default 126): Using default value 126
Last cylinder or +size or +sizeM or +sizeK (126-19457, default 19457): +5120M

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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

Command (m for help):
拡張パーティション。残り全部
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Partition number (1-4): 4
First cylinder (749-19457, default 749): Using default value 749
Last cylinder or +size or +sizeM or +sizeK (749-19457, default 19457): Using default value 19457

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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       19457   150280042+  5 Extended

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

Command (m for help):
/mnt/disk1 残り全部
Command (m for help): n
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
l
First cylinder (874-19457, default 874): Using default value 874
Last cylinder or +size or +sizeM or +sizeK (874-19457, default 19457): Using default value 19457

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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       19457   150280042+  5 Extended
/dev/sdb5             749         873     1004031  83 Linux
/dev/sdb6             874       19457   149275948+ 83 Linux

Command (m for help):
sdb5 の ID 変更
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)

Command (m for help): p

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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       19457   150280042+  5 Extended
/dev/sdb5             749         873     1004031  82 Linux swap
/dev/sdb6             874       19457   149275948+ 83 Linux

Command (m for help):
パーティションを書いて終了。
Command (m for help): w
The partition table has been altered!

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

Disk /dev/sdb: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 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       19457   150280042+  5 Extended
/dev/sdb5             749         873     1004031  82 Linux swap
/dev/sdb6             874       19457   149275948+ 83 Linux
root@LS-XHL25B:~#

フォーマット

sdb1 を ext3 に
root@LS-XHL25B:~# mkfs.ext3 -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)
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 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@LS-XHL25B:~#
sdb2 を ext3 にフォーマットしてから xfs に
root@LS-XHL25B:~# 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)
313248 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
8032 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.
root@LS-XHL25B:~# mkfs.xfs -f /dev/sdb2
meta-data=/dev/sdb2              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, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
root@LS-XHL25B:~#
sdb5 を swap に
root@LS-XHL25B:~# mkswap /dev/sdb5
Setting up swapspace version 1, size = 1028123648 bytes
root@LS-XHL25B:~#
sdb6 を ext3 にフォーマットしてから xfs に
root@LS-XHL25B:~# 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)
9330688 inodes, 37318987 blocks
1865949 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
1139 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

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

This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@LS-XHL25B:~# mkfs.xfs -f /dev/sdb6
meta-data=/dev/sdb6              isize=256    agcount=16, agsize=2332436 blks
         =                       sectsz=512   attr=0
data     =                       bsize=4096   blocks=37318976, imaxpct=25
         =                       sunit=0      swidth=0 blks, unwritten=1
naming   =version 2              bsize=4096
log      =internal log           bsize=4096   blocks=18222, version=1
         =                       sectsz=512   sunit=0 blks, lazy-count=0
realtime =none                   extsz=4096   blocks=0, rtextents=0
root@LS-XHL25B:~#

マウント

root@LS-XHL25B:~# mkdir /tmp/root
root@LS-XHL25B:~# mount /dev/sdb2 /tmp/root
root@LS-XHL25B:~# mkdir /tmp/root/boot
root@LS-XHL25B:~# mount /dev/sdb1 /tmp/root/boot
root@LS-XHL25B:~# mkdir /tmp/root/mnt
root@LS-XHL25B:~# mkdir /tmp/root/mnt/disk1
root@LS-XHL25B:~# mount /dev/sdb6 /tmp/root/mnt/disk1
root@LS-XHL25B:~# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              4989760    335504   4654256   7% /
/dev/ram1                15360       120     15240   1% /mnt/ram
/dev/sda1               992036    135700    856336  14% /boot
/dev/disk1_6         141368380       612 141367768   0% /mnt/disk1
/dev/sdb2              4993984       320   4993664   0% /mnt/ram/root
/dev/sdb1               988212     17652    920360   2% /mnt/ram/root/boot
/dev/sdb6            149203016       544 149202472   0% /mnt/ram/root/mnt/disk1
root@LS-XHL25B:~#

コピー

例によって動いているシステムをコピーする。
root@LS-XHL25B:/# ls -l
drwxr-xr-x    2 root     root         4096 Dec 26 14:21 bin
drwxr-xr-x    2 root     root         4096 Feb  6 14:51 boot
-rw-r--r--    1 root     root        14193 Dec 24 11:59 buffalo-web-us.deb
drwxr-xr-x    2 root     root           35 Dec 26 14:21 debugtool
drwxr-xr-x    6 root     root         8192 Feb  6 14:52 dev
drwxr-xr-x   24 root     root         4096 Feb  6 14:52 etc
drwxrwxrwx    3 root     root           19 Dec 26 14:21 home
drwxr-xr-x    2 root     root            6 Dec 26 14:20 initrd
drwxr-xr-x    4 root     root         4096 Nov  1  2007 lib
lrwxrwxrwx    1 root     root           15 Nov  1  2007 lighttpd.webui -> /lighttpd.webui
drwxrwxrwx   11 root     root          126 Feb  6 14:51 mnt
drwxr-xr-x    3 root     root           19 Feb  6 14:51 modules
dr-xr-xr-x   79 root     root            0 Jan  1  1970 proc
drwxr-xr-x    3 root     root           39 Nov  1  2007 root
drwxr-xr-x    2 root     root         4096 Feb  6 14:51 sbin
drwxr-xr-x    2 root     root            6 Oct 20 20:23 share
drwxr-xr-x   10 root     root            0 Jan  1  1970 sys
lrwxrwxrwx    1 root     root            8 Feb  6 14:51 tmp -> /mnt/ram
drwxr-xr-x   11 root     root          109 Dec 26 14:21 usr
drwxr-xr-x   11 root     root          131 Feb  6 14:51 var
drwxrwxrwx    6 root     root           75 Dec 26 14:21 www
root@LS-XHL25B:/# tar cf - [b-l]* |(cd /tmp/root/; tar xvf -)
	:
	:
root@LS-XHL25B:/# cd mnt
root@LS-XHL25B:/mnt# ls
array1      disk1       info        ram         usbdisk2
authtest    disk2       msdfs_root  usbdisk1
root@LS-XHL25B:/mnt# tar cf - [a-m,u]* |(cd /tmp/root/mnt/; tar xvf -)
	:
	:
root@LS-XHL25B:/mnt# mkdir /tmp/root/mnt/ram
root@LS-XHL25B:/# tar cf - modules/|(cd /tmp/root/; tar xvf -)
	:
root@LS-XHL25B:/# mkdir /tmp/root/proc
root@LS-XHL25B:/# tar cf - r* |(cd /tmp/root; tar xvf -)
	:
root@LS-XHL25B:/# tar cf - sbin* |(cd /tmp/root; tar xvf -)
	:
root@LS-XHL25B:/# tar cf - share* |(cd /tmp/root; tar xvf -)
	:
root@LS-XHL25B:/# tar cf - share* |(cd /tmp/root; tar xvf -)
	:
root@LS-XHL25B:/# mkdir /tmp/root/sys
root@LS-XHL25B:/# tar cf - tmp |(cd /tmp/root/; tar xvf -)
tmp
root@LS-XHL25B:/# tar cf - usr |(cd /tmp/root/; tar xvf -)
	:
root@LS-XHL25B:/# tar cf - var |(cd /tmp/root/; tar xvf -)
	:
root@LS-XHL25B:/# tar cf - www |(cd /tmp/root/; tar xvf -)
	:
root@LS-XHL25B:/# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda2              4989760    335124   4654636   7% /
/dev/ram1                15360       120     15240   1% /mnt/ram
/dev/sda1               992036    135700    856336  14% /boot
/dev/disk1_6         141368380       612 141367768   0% /mnt/disk1
/dev/sdb2              4993984    355200   4638784   7% /mnt/ram/root
/dev/sdb1               988212    135716    802296  14% /mnt/ram/root/boot
/dev/sdb6            149203016       636 149202380   0% /mnt/ram/root/mnt/disk1
root@LS-XHL25B:/#
なんかちがうけど、、、

ログアウト

シャットダウン

電源SWで電源OFF

HDD 交換

WD1600 を SATA で接続

電源 ON

青点滅でうまくいくかと思ったが、、、

赤で E06。

やっぱり GPT やないとあかんか。



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


スピンアップしない
ハックの記録
LinkStation/玄箱 をハックしよう

ファームウェア 1.03 のインストール

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