debian 簡単インストール(3)再インストール

KURO-BOX/Pro debian

再開ポイントの hddrootfs.tar.gz をインストールし直す。

前回のインストールでは、一度インストールした HDD の パーティションを消しただけで再利用したらえらい目にあった。
今回は、xfs をつぶすために ext3 でフォーマットしてから パーティションを消し、その後で再インストールする。

再開ポイントの hddrootfs.tar.gz を mtd におく

hackkit:~# mkdir /tmp/mtd3
hackkit:~# mount /dev/mtd3 /tmp/mtd3
hackkit:~# ls /tmp/mtd3
ChangeMeDevHDD  ChangeMyUbootEnv  hddrootfs.tar.gz  uImage.buffalo  www
hackkit:~# cd /mnt/
hackkit:/mnt# cp hddrootfs.tar.gz /tmp/mtd3
hackkit:/mnt# 

flash boot モードで起動する

実験用 HDD につなぎ直し、flash boot mode で起動する。

起動すると /dev/sda4 が自動的にマウントされるので、umount する。
~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtd2                65536     15904     49632  24% /
/dev/ram1                 8192       140      8052   2% /mnt/ram
/dev/sda4            114029892      5648 114024244   0% /mnt/disk1
/dev/mtd3               192512     54816    137696  28% /mnt/mtd
~ # umount /mnt/disk1/
~ #

ext3 でフォーマットする

~ # fdisk /dev/sda

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

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1           7       56196  83 Linux
/dev/sda2               8         373     2939895  83 Linux
/dev/sda3             374         390      136552+ 82 Linux swap
/dev/sda4             391       14593   114085597+ 83 Linux

Command (m for help): q

~ # mkfs.ext2 -j /dev/sda1
mke2fs 1.27 (8-Mar-2002)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
14056 inodes, 56196 blocks
2809 blocks (5.00%) reserved for the super user
First data block=1
7 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
        8193, 24577, 40961

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.
~ # mkfs.ext2 -j /dev/sda2
mke2fs 1.27 (8-Mar-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
368000 inodes, 734973 blocks
36748 blocks (5.00%) reserved for the super user
First data block=0
23 block groups
32768 blocks per group, 32768 fragments per group
16000 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (8192 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.
~ # mkfs.ext2 -j /dev/sda4
mke2fs 1.27 (8-Mar-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
14270464 inodes, 28521399 blocks
1426069 blocks (5.00%) reserved for the super user
First data block=0
871 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 (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
~ #
これでもう大丈夫やろ。

パーティションを消す

~ # fdisk /dev/sda

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

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1           7       56196  83 Linux
/dev/sda2               8         373     2939895  83 Linux
/dev/sda3             374         390      136552+ 82 Linux swap
/dev/sda4             391       14593   114085597+ 83 Linux

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

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

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

Command (m for help): d
Selected partition 4

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

Calling ioctl() to re-read partition table
SCSI device sda: 234441648 512-byte hdwr sectors (120034 MB)
SCSI device sda: drive cache: write back
 sda:
~ #

RESET SW を長押しする

 # SCSI device sda: 234441648 512-byte hdwr sectors (120034 MB)
SCSI device sda: drive cache: write back
 sda: sda1 sda2 sda3 sda4
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sda1, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
XFS mounting filesystem sda2
XFS: failed to read root inode

~ #
faild だそう。
~ # fdisk /dev/sda

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

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1           7       56196  83 Linux
/dev/sda2               8         373     2939895  83 Linux
/dev/sda3             374         390      136552+ 82 Linux swap
/dev/sda4             391       14593   114085597+ 83 Linux

Command (m for help): q

~ #
パーティションは切られている
~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtd2                65536     15908     49628  24% /
/dev/ram1                 8192       152      8040   2% /mnt/ram
/dev/mtd3               192512     53716    138796  28% /mnt/mtd
/dev/sda1                54416      4127     47480   8% /mnt/boot
~ # 
マウントされていないので、マウントしてみる
~ # mount /dev/sda2 /mnt/root
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sda2, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
~ # 
ん? ext3 ?
~ # mount /dev/sda2 /mnt/root
~ # umount /mnt/root
~ # mount -t xfs /dev/sda2 /mnt/root
XFS mounting filesystem sda2
XFS: failed to read root inode
mount: mounting /dev/sda2 on /mnt/root failed
~ #
なんで、XFS にフォーマットせぇへんねん。

手動実行

~ # umount /mnt/boot
~ # fdisk /dev/sda

The number of cylinders for this disk is set to 14593.
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): 1

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

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

Command (m for help): d
Selected partition 4

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

Calling ioctl() to re-read partition table
SCSI device sda: 234441648 512-byte hdwr sectors (120034 MB)
SCSI device sda: drive cache: write back
 sda:
~ # sh -x /usr/local/bin/InitDisk1.sh 
	:
	:
+ Format_XFS /dev/sda2
+ dd if=/dev/sda2 bs=1 count=3
3+0 records in
3+0 records out
+ KEY=XFS
+ [ XFS = XFS ]
+ . /etc/melco/info
+ [  = yes ]
+ return 0
+ Format_XFS /dev/sda4
+ dd if=/dev/sda4 bs=1 count=3
3+0 records in
3+0 records out
+ KEY=XFS
+ [ XFS = XFS ]
+ . /etc/melco/info
+ [  = yes ]
+ return 0
+ mkswap 3
mkswap: 3: No such file or directory
+ /usr/local/sbin/SetupDevEnv.sh
mkdir: cannot create directory '/mnt/boot': File exists
mkdir: cannot create directory '/mnt/rootfs': File exists
kjournald starting.  Commit interval 5 seconds
EXT3 FS on sda1, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
XFS mounting filesystem sda2
XFS: failed to read root inode
mount: mounting /dev/sda2 on /mnt/rootfs failed
+ miconapl -a led_set_code_information clear
~ # 
ext3 でフォーマットしても 各パーティションの先頭に XFS という文字列が残ったまま。
フォーマットした上で先頭3バイトを消す。
~ # mkfs.ext3 -j /dev/sda2
mke2fs 1.27 (8-Mar-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
368000 inodes, 734973 blocks
36748 blocks (5.00%) reserved for the super user
First data block=0
23 block groups
32768 blocks per group, 32768 fragments per group
16000 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

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.
~ # dd if=/dev/zero of=/dev/sda2 bs=1 count=3
3+0 records in
3+0 records out
~ # mkfs.ext3 -j /dev/sda
mke2fs 1.27 (8-Mar-2002)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n)
~ # mkfs.ext3 -j /dev/sda4
mke2fs 1.27 (8-Mar-2002)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
14270464 inodes, 28521399 blocks
1426069 blocks (5.00%) reserved for the super user
First data block=0
871 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 (8192 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.
~ # dd if=/dev/zero of=/dev/sda4 bs=1 count=3
3+0 records in
3+0 records out
~ # fdisk /dev/sda

The number of cylinders for this disk is set to 14593.
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): 1

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

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

Command (m for help): d
Selected partition 4

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

Calling ioctl() to re-read partition table
SCSI device sda: 234441648 512-byte hdwr sectors (120034 MB)
SCSI device sda: drive cache: write back
 sda:
~ #
もういい加減できるやろ。
~ # sh -x /usr/local/bin/InitDisk1.sh 
	:
	:
~ # 
できた。

パーミッション

またまた寄り道してパーミッションを見る
~ # df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtd2                65536     15904     49632  24% /
/dev/ram1                 8192       152      8040   2% /mnt/ram
/dev/mtd3               192512     53716    138796  28% /mnt/mtd
/dev/sda1                54416      5831     45776  11% /mnt/boot
/dev/sda2              2929652    147844   2781808   5% /mnt/rootfs
~ # ls -ld /mnt/rootfs/tmp
drwxr-xr-t    2 root     root            6 Mar  8 21:11 /mnt/rootfs/tmp
~ # ls -ld /mnt/rootfs/var/tmp
drwxr-xr-t    3 root     root           23 Mar  9 23:27 /mnt/rootfs/var/tmp
~ # ls -ld /mnt/rootfs/bin/su
-rwxr-xr-x    1 root     root        22840 Aug 14  2006 /mnt/rootfs/bin/su
~ #
おちてるやんか。


KURO-BOX/PRO
玄人志向
楽天市場
TSUKUMO ネットショップ
Yahoo!ショッピング
Sofmap
クレバリー
TwoTop

SCON-KIT/PRO
玄人志向
TSUKUMO ネットショップ
Yahoo! ショッピング
パソQ
ValuMore
uWorks

玄箱PROをハックしよう
ASCII
楽天ブックス
Amazon
cbook24
e-hon
JBook
BK1
livedoorブックス
紀伊國屋書店BookWeb


Web サーバ
ハックの記録
LinkStation/玄箱 をハックしよう

パーミッションを落とす tar

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