Feb 16, 2005
KEK, Online
by E.Inoue
確認事項: このメモは以下の3項を満たす環境で作業を行うことを想定          している。
  (1). knoppixシステムが利用可能なPCを使用する。
  (2). PCはUSBポートが利用可能である。
  (3). USB-コンパクトフラッシュR/Wアダプタを所有している。
|
(3). KNOPPIXシステムからの復旧
上記の項目(2-6)で作成した CC/NET用の KNOPPIX CD を使ってコンパクトフラッ
シュ上に Debian GNU/Linux システムを復旧する。
(3-1). 作成した KNOPPIX CDを起動
onlpc03.kek.jp のマシンに、上記の項目(2-6)で作成した CC/NET用の KNOPPIX CD
をセットし電源をonした。 KNOPPIXシステムは正常に立ち上がった。
(3-2). KNOPPIXのCDに組み込んだ compact.tar.gzからの復旧
KNOPPIXシステムに組み込んだ CC/NET用の復旧ファイルを確認する。
knoppix@ttyp0[/]$ pwd
/
knoppix@ttyp0[/]$ ls
KNOPPIX boot dev home mnt opt ramdisk sbin sys usr
bin cdrom etc lib none proc root sfs tmp var
knoppix@ttyp0[/]$ ls KNOPPIX
TOYO cdrom floppy lib none root tmp vmlinuz
bin dev home lost+found opt sbin usr vmlinuz.old
boot etc initrd mnt proc sys var
knoppix@ttyp0[/]$
knoppix@ttyp0[/]$ ls -l KNOPPIX/TOYO
合計 148637
-rw-r--r-- 1 root root 152203938 2005-02-15 11:22 compact-debian-Feb92005.tar.gz
lrwxrwxrwx 1 root root 30 2005-02-15 11:26 compact.tar.gz -> compact-debian-Feb92005.tar.gz
knoppix@ttyp0[/]$
(3-2-1). コンパクトフラッシュの準備
root@ttyp0[/]# fdisk -l
Disk /dev/sda: 40.0 GB, 40029954048 bytes
255 heads, 63 sectors/track, 4866 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes
デバイス Boot Start End Blocks Id System
/dev/sda1 * 1 127 1020096 b W95 FAT32
/dev/sda2 128 2040 15366172+ c W95 FAT32 (LBA)
/dev/sda3 3847 4866 8193150 f W95 Ext'd (LBA)
/dev/sda4 2041 3846 14506695 83 Linux
/dev/sda5 3847 4866 8193118+ b W95 FAT32
領域テーブル項目がディスクの順序と一致しません
Disk /dev/sdb: 40.0 GB, 40029954048 bytes
255 heads, 63 sectors/track, 4866 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes
デバイス Boot Start End Blocks Id System
/dev/sdb1 1 13 104391 83 Linux
/dev/sdb2 1983 4866 23165730 83 Linux
/dev/sdb3 111 1982 15036840 f W95 Ext'd (LBA)
/dev/sdb4 14 110 779152+ 82 Linux スワップ
/dev/sdb5 * 111 716 4867663+ 83 Linux
/dev/sdb6 717 1610 7181023+ 83 Linux
/dev/sdb7 * 1611 1982 2988058+ 83 Linux
領域テーブル項目がディスクの順序と一致しません
Disk /dev/sdc: 80.0 GB, 80020684800 bytes
255 heads, 63 sectors/track, 9728 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes
デバイス Boot Start End Blocks Id System
/dev/sdc1 * 1 1217 9775521 83 Linux
/dev/sdc2 1218 2434 9775552+ 83 Linux
/dev/sdc3 2435 3651 9775552+ 83 Linux
/dev/sdc4 3652 9728 48813502+ f W95 Ext'd (LBA)
/dev/sdc5 3652 4868 9775521 83 Linux
/dev/sdc6 4869 6085 9775521 83 Linux
/dev/sdc7 6086 7302 9775521 83 Linux
/dev/sdc8 7303 8519 9775521 83 Linux
/dev/sdc9 8520 9728 9711261 83 Linux
Disk /dev/sdd: 80.0 GB, 80020684800 bytes
255 heads, 63 sectors/track, 9728 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes
デバイス Boot Start End Blocks Id System
/dev/sdd1 * 1 1217 9775521 83 Linux
/dev/sdd2 1218 2434 9775552+ 83 Linux
/dev/sdd3 2435 3651 9775552+ 83 Linux
/dev/sdd4 3652 9728 48813502+ f W95 Ext'd (LBA)
/dev/sdd5 3652 4868 9775521 83 Linux
/dev/sdd6 4869 6085 9775521 83 Linux
/dev/sdd7 6086 7302 9775521 83 Linux
/dev/sdd8 7303 8519 9775521 83 Linux
/dev/sdd9 8520 9728 9711261 83 Linux
Disk /dev/sde: 512 MB, 512483328 bytes
16 heads, 63 sectors/track, 993 cylinders
Units = シリンダ数 of 1008 * 512 = 516096 bytes
デバイス Boot Start End Blocks Id System
/dev/sde1 * 1 993 500440+ 83 Linux
Disk /dev/hda: 20.5 GB, 20576747520 bytes
255 heads, 63 sectors/track, 2501 cylinders
Units = シリンダ数 of 16065 * 512 = 8225280 bytes
デバイス Boot Start End Blocks Id System
/dev/hda1 1 255 2048256 1b Hidden W95 FAT32
/dev/hda2 256 651 3180870 82 Linux スワップ
/dev/hda3 652 2501 14860125 f W95 Ext'd (LBA)
/dev/hda5 652 668 136521 82 Linux スワップ
/dev/hda6 669 923 2048256 b W95 FAT32
/dev/hda7 924 1289 2939863+ b W95 FAT32
/dev/hda8 1290 1544 2048256 b W95 FAT32
/dev/hda9 1545 1799 2048256 b W95 FAT32
/dev/hda10 1800 2501 5638783+ b W95 FAT32
root@ttyp0[/]#
USB コンパクトフラッシュ・アダプタは /dev/sde として KNOPPIXシステムに認識
されている。 コンパクトフラッシュのメディアをパーティショニングする。
注.
私が作業しているPCの環境では、USB コンパクトフラッシュ・アダプタが
/dev/sdeデバイスとして認識されている。 ユーザが使用しているPCの環境に
よってデバイス名は異なるので注意すること。
root@ttyp0[/]# fdisk /dev/sde
コマンド (m でヘルプ): m
コマンドの動作
a ブート可能フラグをつける
b bsd ディスクラベルを編集する
c dos 互換フラグをつける
d 領域を削除する
l 既知の領域タイプをリスト表示する
m このメニューを表示する
n 新たに領域を作成する
o 新たに空の DOS 領域テーブルを作成する
p 領域テーブルを表示する
q 変更を保存せずに終了する
s 空の Sun ディスクラベルを作成する
t 領域のシステム ID を変更する
u 表示/項目ユニットを変更する
v 領域テーブルを照合する
w テーブルをディスクに書き込み、終了する
x 特別な機能 (エキスパート専用)
コマンド (m でヘルプ): p
Disk /dev/sde: 512 MB, 512483328 bytes
16 heads, 63 sectors/track, 993 cylinders
Units = シリンダ数 of 1008 * 512 = 516096 bytes
デバイス Boot Start End Blocks Id System
/dev/sde1 * 1 993 500440+ 83 Linux
コマンド (m でヘルプ): d
Selected partition 1
コマンド (m でヘルプ): n
コマンドアクション
e 拡張
p 基本領域 (1-4)
p
領域番号 (1-4): 1
最初 シリンダ (1-993, default 1):
Using default value 1
終点 シリンダ または +サイズ または +サイズM または +サイズK (1-993, default 993):
Using default value 993
コマンド (m でヘルプ): w
領域テーブルは交換されました!
ioctl() を呼び出して領域テーブルを再読込みします。
ディスクを同期させます。
root@ttyp0[/]#
ファイルシステムを作成する。
root@ttyp0[/]# mke2fs -j /dev/sde1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
125488 inodes, 500440 blocks
25022 blocks (5.00%) reserved for the super user
First data block=1
62 block groups
8192 blocks per group, 8192 fragments per group
2024 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 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
root@ttyp0[/]#
コンパクトフラッシュをマウントする。
root@ttyp0[/]# mount -t ext3 /dev/sde1 /mnt/sde1
root@ttyp0[/]# df -k
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
/dev/root 3471 1167 2304 34% /
/dev/scd0 675250 675250 0 100% /cdrom
/dev/cloop 1566814 1566814 0 100% /KNOPPIX
/ramdisk 301736 6992 294744 3% /ramdisk
/dev/sde1 484602 8239 451341 2% /mnt/sde1
root@ttyp0[/]#
(3-2-2). compact.tar.gzを展開
/KNOPPIX/TOYO/compact-debian-Feb92005.tar.gzファイルをコンパクトフラッ
シュ上に展開する。
root@ttyp0[TOYO]# pwd
/KNOPPIX/TOYO
root@ttyp0[TOYO]# ls -l
合計 148637
-rw-r--r-- 1 root root 152203938 2005-02-15 11:22 compact-debian-Feb92005.tar.gz
lrwxrwxrwx 1 root root 30 2005-02-15 11:26 compact.tar.gz -> compact-debian-Feb92005.tar.gz
root@ttyp0[TOYO]#
root@ttyp0[TOYO]# cd /mnt/sde1
root@ttyp0[sde1]# pwd
/mnt/sde1
root@ttyp0[sde1]# ls -l
合計 12
drwx------ 2 root root 12288 2005-02-16 13:27 lost+found
root@ttyp0[sde1]#
root@ttyp0[sde1]# tar xzf /KNOPPIX/TOYO/compact.tar.gz
root@ttyp0[sde1]#
注.
私の旧式のPCでは、ファイルを展開するのに約30分かかった。
root@ttyp0[sde1]# pwd
/mnt/sde1
root@ttyp0[sde1]# ls -l
合計 55
drwxr-xr-x 2 root root 2048 2003-10-22 15:05 bin
drwxr-xr-x 3 root root 1024 2003-10-22 11:26 boot
drwxr-xr-x 2 root root 1024 2003-10-22 18:34 cdrom
drwxr-xr-x 9 root root 21504 2003-12-10 15:29 dev
drwxr-xr-x 44 root root 3072 2003-12-10 15:29 etc
drwxr-xr-x 2 root root 1024 2003-10-22 18:34 floppy
drwxrwsr-x 3 root staff 1024 2003-12-03 08:46 home
drwxr-xr-x 2 root root 1024 2003-10-22 18:34 initrd
drwxr-xr-x 5 root root 3072 2003-10-22 10:27 lib
drwx------ 2 root root 12288 2003-10-22 17:51 lost+found
drwxr-xr-x 2 root root 1024 2002-02-09 00:42 mnt
drwxr-xr-x 2 root root 1024 2003-10-22 18:34 opt
drwxr-xr-x 2 root root 1024 2002-02-09 00:42 proc
drwxr-xr-x 4 root root 1024 2003-10-23 09:20 ramfs
drwxr-xr-x 3 root root 1024 2003-10-22 14:43 root
drwxr-xr-x 2 root root 2048 2003-11-21 13:37 sbin
lrwxrwxrwx 1 root root 9 2005-02-16 13:33 tmp -> ramfs/tmp
drwxr-xr-x 13 root root 1024 2003-11-21 14:41 usr
lrwxrwxrwx 1 root root 9 2005-02-16 13:53 var -> ramfs/var
lrwxrwxrwx 1 root root 25 2005-02-16 13:33 vmlinuz -> boot/vmlinuz-2.4.18-bf2.4
root@ttyp0[sde1]#
root@ttyp0[sde1]# e2label /dev/sde1
root@ttyp0[sde1]# e2label /dev/sde1 /
root@ttyp0[sde1]# e2label /dev/sde1
/
root@ttyp0[sde1]#
root@ttyp0[sde1]# cd usr/local/sbin
root@ttyp0[sbin]# ls -l grub
-rwxr-xr-x 1 root staff 396365 2003-10-22 11:11 grub
root@ttyp0[sbin]#
root@ttyp0[sbin]# ./grub
Probing devices to guess BIOS drives. This may take a long time.
GRUB version 0.93 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ]
grub> root (hd5,0)
root (hd5,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd5)
setup (hd5)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd5)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd5) (hd5)1+16 p (hd5,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.
grub> quit
quit
root@ttyp0[sbin]#
注.
"root (hd5,0)" および "setup (hd5)" のコマンドで指定するハードディス
クの番号は、ユーザの使用環境によって変わる。 私の環境では、
内蔵IDEハードディスク : /dev/hda hd0
外部SCSIディスク : /dev/sda hd1
外部SCSIディスク : /dev/sdb hd2
外部SCSIディスク : /dev/sdc hd3
外部SCSIディスク : /dev/sdd hd4
USB-コンパクトフラッシュR/Wアダプタ : /dev/sde hd5
となっている。
Linuxシステムの構築が完了したコンパクトフラッシュをアンマウントする。
root@ttyp0[sbin]# cd /
root@ttyp0[/]#
root@ttyp0[/]# df -k
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
/dev/root 3471 1167 2304 34% /
/dev/scd0 675250 675250 0 100% /cdrom
/dev/cloop 1566814 1566814 0 100% /KNOPPIX
/ramdisk 301736 6992 294744 3% /ramdisk
/dev/sde1 484602 441838 17742 97% /mnt/sde1
root@ttyp0[/]#
root@ttyp0[/]# umount /mnt/sde1
root@ttyp0[/]#
root@ttyp0[/]# df -k
Filesystem 1K-ブロック 使用 使用可 使用% マウント位置
/dev/root 3471 1167 2304 34% /
/dev/scd0 675250 675250 0 100% /cdrom
/dev/cloop 1566814 1566814 0 100% /KNOPPIX
/ramdisk 301736 6992 294744 3% /ramdisk
root@ttyp0[/]#
USB コンパクトフラッシュ・アダプタからコンパクトフラッシュのメディアを
外す。
(3-2-3). 作成したコンパクトフラッシュを起動
上記の項目(3-2-2) で作成したコンパクトフラッシュのメディアを CC/NET に
装着して Linuxシステムを起動する。
onlsun4[34]% ssh toyo@onlsbc1
toyo@onlsbc1's password:
Linux onlsbc1 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i586 unknown
Most of the programs included with the Debian GNU/Linux system are
freely redistributable; the exact distribution terms for each program
are described in the individual files in /usr/share/doc/*/copyright
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Nov 21 14:44:20 2003 from onlsun4.kek.jp
toyo@onlsbc1:~$
toyo@onlsbc1:~$ df -k
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hdc1 484602 441839 17741 97% /
toyo@onlsbc1:~$
ここで再度リブートしてみる。
toyo@onlsbc1:~$ su
Password:
onlsbc1:/home/toyo# reboot
Broadcast message from root (pts/0) (Wed Feb 16 14:32:02 2005):
The system is going down for reboot NOW!
:
:
onlsun4[35]% ssh toyo@onlsbc1
toyo@onlsbc1's password:
Linux onlsbc1 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i586 unknown
Most of the programs included with the Debian GNU/Linux system are
freely redistributable; the exact distribution terms for each program
are described in the individual files in /usr/share/doc/*/copyright
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Nov 21 14:44:20 2003 from onlsun4.kek.jp
toyo@onlsbc1:~$ df -k
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hdc1 484602 441839 17741 97% /
toyo@onlsbc1:~$
ok. 利用可能ディスクスペースに変化は見られない。
toyo@onlsbc1:~$ ls -l
total 4
drwxr-xr-x 2 toyo toyo 1024 Dec 10 2003 camac
drwxr-xr-x 2 toyo toyo 1024 Nov 7 2003 check
drwxr-xr-x 3 toyo toyo 1024 Nov 19 2003 public_html
drwxr-xr-x 2 toyo toyo 1024 Dec 10 2003 remote-camac
toyo@onlsbc1:~$
toyo@onlsbc1:~$ ls -l /
total 54
drwxr-xr-x 2 root root 2048 Oct 22 2003 bin
drwxr-xr-x 3 root root 1024 Oct 22 2003 boot
drwxr-xr-x 2 root root 1024 Oct 22 2003 cdrom
drwxr-xr-x 9 root root 21504 Feb 16 14:33 dev
drwxr-xr-x 44 root root 3072 Feb 16 14:33 etc
drwxr-xr-x 2 root root 1024 Oct 22 2003 floppy
drwxrwsr-x 3 root staff 1024 Dec 3 2003 home
drwxr-xr-x 2 root root 1024 Oct 22 2003 initrd
drwxr-xr-x 5 root root 3072 Oct 22 2003 lib
drwx------ 2 root root 12288 Oct 22 2003 lost+found
drwxr-xr-x 2 root root 1024 Feb 9 2002 mnt
drwxr-xr-x 2 root root 1024 Oct 22 2003 opt
dr-xr-xr-x 39 root root 0 Feb 16 2005 proc
drwxr-xr-x 5 root root 1024 Feb 16 14:33 ramfs
drwxr-xr-x 3 root root 1024 Oct 22 2003 root
drwxr-xr-x 2 root root 2048 Nov 21 2003 sbin
lrwxrwxrwx 1 root root 9 Feb 16 13:33 tmp -> ramfs/tmp
drwxr-xr-x 13 root root 1024 Nov 21 2003 usr
lrwxrwxrwx 1 root root 9 Feb 16 13:53 var -> ramfs/var
lrwxrwxrwx 1 root root 25 Feb 16 13:33 vmlinuz -> boot/vmlinuz-
2.4.18-bf2.4
toyo@onlsbc1:~$
ok. KNOPPIX CD から復旧したコンパクトフラッシュを装着したCC/NET上の
Debian GNU/Linux システムは正常に立ち上がった。