Sep 22, 2004
								KEK, Online
								by E.Inoue


	USB-コンパクトフラッシュアダプターに 1GBのコンパクトフラッシュメディアを
	セットして、Linuxが起動しているマシンのUSBポートに接続する。

onlsbc1:/# dmesg
Linux version 2.4.26-1-386 (herbert@gondolin) (gcc version 3.3.3 (Debian 2004040
1)) #2 Sat May 1 16:31:24 EST 2004
BIOS-provided physical RAM map:
			:
			:
 /dev/ide/host0/bus1/target0/lun0: p1
 /dev/ide/host0/bus1/target0/lun0: p1
kjournald starting.  Commit interval 5 seconds
EXT3 FS 2.4-0.9.19, 19 August 2002 on ide1(22,1), internal journal
EXT3-fs: mounted filesystem with ordered data mode.
hub.c: new USB device 00:07.2-2, assigned address 3
usb.c: USB device 3 (vend/prod 0x411/0x36) is not claimed by any active driver.
SCSI subsystem driver Revision: 1.00
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
scsi0 : SCSI emulation for USB Mass Storage devices
usb-uhci.c: interrupt, status 2, frame# 1299
  Vendor: BUFFALO   Model: MCR-CF/U2         Rev:
  Type:   Direct-Access                      ANSI SCSI revision: 02
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 3
USB Mass Storage support registered.
onlsbc1:/#

onlsbc1:/# fdisk /dev/sda

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sda: 1024 MB, 1024966656 bytes
32 heads, 63 sectors/track, 993 cylinders
Units = cylinders of 2016 * 512 = 1032192 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         993     1000912+   6  FAT16

Command (m for help): d
Selected partition 1

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

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

Calling ioctl() to re-read partition table.
Syncing disks.
onlsbc1:/#

onlsbc1:/# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 1024 MB, 1024966656 bytes
32 heads, 63 sectors/track, 993 cylinders
Units = cylinders of 2016 * 512 = 1032192 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         993     1000912+  83  Linux

Command (m for help): q

onlsbc1:/#

	ext3 ファイルシステムを作成する。 

onlsbc1:/# mke2fs -j /dev/sda1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
125184 inodes, 250228 blocks
12511 blocks (5.00%) reserved for the super user
First data block=0
8 block groups
32768 blocks per group, 32768 fragments per group
15648 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 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
onlsbc1:/#

onlsbc1:/# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda1               918322    699493    169833  81% /
tmpfs                   152824         0    152824   0% /dev/shm
/dev/hdc1               938008    568689    319274  65% /mnt
onlpara:/home2/onlpara-wrk
                      22659864   6122376  15386432  29% /mnt2
onlsbc1:/#

onlsbc1:/# mount -t ext3 /dev/sda1 /mnt1
onlsbc1:/#
onlsbc1:/# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda1               918322    699493    169833  81% /
tmpfs                   152824         0    152824   0% /dev/shm
/dev/hdc1               938008    568689    319274  65% /mnt
onlpara:/home2/onlpara-wrk
                      22659864   6122376  15386432  29% /mnt2
/dev/sda1               985160     16428    918688   2% /mnt1
onlsbc1:/#

onlsbc1:/# cd /mnt1
onlsbc1:/mnt1# ls -l
total 16
drwx------    2 root     root        16384 Sep 21 16:16 lost+found
onlsbc1:/mnt1#
onlsbc1:/mnt1# ls -l /mnt2/root/com*
-rw-r--r--    1 nobody   nogroup  155195644 Dec 10  2003 /mnt2/root/compact-debi
an-Dec102003g.tar.gz
-rw-r--r--    1 nobody   nogroup  155654709 Nov 12  2003 /mnt2/root/compact-debi
an-Nov122003g.tar.gz
-rw-r--r--    1 nobody   nogroup  134842364 Nov 18  2003 /mnt2/root/compact-debi
an-Nov182003g.tar.gz
-rw-r--r--    1 nobody   nogroup  155714516 Nov 19  2003 /mnt2/root/compact-debi
an-Nov192003g.tar.gz
-rw-r--r--    1 nobody   nogroup  155287959 Nov 21  2003 /mnt2/root/compact-debi
an-Nov212003g.tar.gz
-rw-r--r--    1 nobody   nogroup  155640097 Nov  5  2003 /mnt2/root/compact-debi
an-Nov52003g.tar.gz
-rw-r--r--    1 nobody   nogroup  196485325 Sep 21 10:50 /mnt2/root/compact-debi
an-Sep212004.tar.gz
-rw-r--r--    1 nobody   nogroup  143602724 Oct 16  2003 /mnt2/root/compact-debi
an-oct162003.tar.gz
-rw-r--r--    1 nobody   nogroup  143656305 Oct 17  2003 /mnt2/root/compact-debi
an-oct172003.tar.gz
-rw-r--r--    1 nobody   nogroup  144092715 Oct 20  2003 /mnt2/root/compact-debi
an-oct202003A.tar.gz
-rw-r--r--    1 nobody   nogroup  144132052 Oct 21  2003 /mnt2/root/compact-debi
an-oct212003.tar.gz
-rw-r--r--    1 nobody   nogroup  146957840 Oct 21  2003 /mnt2/root/compact-debi
an-oct212003g.tar.gz
-rw-r--r--    1 nobody   nogroup  112241121 Oct 22  2003 /mnt2/root/compact-debi
an-oct222003g.tar.gz
-rw-r--r--    1 nobody   nogroup  163407952 Oct 23  2003 /mnt2/root/compact-debi
an-oct232003g.tar.gz
-rw-r--r--    1 nobody   nogroup  163268550 Oct 23  2003 /mnt2/root/compact-debi
an-oct232003g.tar.gz-old
-rw-r--r--    1 nobody   nogroup  156120096 Oct 30  2003 /mnt2/root/compact-debi
an-oct302003g.tar.gz
-rw-r--r--    1 nobody   nogroup  160988392 May 11 15:56 /mnt2/root/compact-redh
at8-May112004.tar.gz
-rw-r--r--    1 nobody   nogroup  152726128 May 21  2003 /mnt2/root/compact.tar.
gz
onlsbc1:/mnt1#
onlsbc1:/mnt1#
onlsbc1:/mnt1# ls /mnt2/root/com*
/mnt2/root/compact-debian-Dec102003g.tar.gz
/mnt2/root/compact-debian-Nov122003g.tar.gz
/mnt2/root/compact-debian-Nov182003g.tar.gz
/mnt2/root/compact-debian-Nov192003g.tar.gz
/mnt2/root/compact-debian-Nov212003g.tar.gz
/mnt2/root/compact-debian-Nov52003g.tar.gz
/mnt2/root/compact-debian-Sep212004.tar.gz
/mnt2/root/compact-debian-oct162003.tar.gz
/mnt2/root/compact-debian-oct172003.tar.gz
/mnt2/root/compact-debian-oct202003A.tar.gz
/mnt2/root/compact-debian-oct212003.tar.gz
/mnt2/root/compact-debian-oct212003g.tar.gz
/mnt2/root/compact-debian-oct222003g.tar.gz
/mnt2/root/compact-debian-oct232003g.tar.gz
/mnt2/root/compact-debian-oct232003g.tar.gz-old
/mnt2/root/compact-debian-oct302003g.tar.gz
/mnt2/root/compact-redhat8-May112004.tar.gz
/mnt2/root/compact.tar.gz
onlsbc1:/mnt1#
onlsbc1:/mnt1# tar xzf /mnt2/root/compact-debian-Sep212004.tar.gz
onlsbc1:/mnt1#
onlsbc1:/mnt1# e2label /dev/sda1

onlsbc1:/mnt1# e2label /dev/sda1 /
onlsbc1:/mnt1# e2label /dev/sda1
/
onlsbc1:/mnt1#

onlsbc1:/mnt1# pwd
/mnt1
onlsbc1:/mnt1# ls -l
total 104
drwxr-xr-x    2 root     root         4096 Sep  9 20:00 bin
drwxr-xr-x    3 root     root         4096 Sep 21 10:41 boot
drwxr-xr-x   11 root     root        24576 Sep 17 16:41 dev
drwxr-xr-x   52 root     root         4096 Sep 17 16:41 etc
drwxrwsr-x    3 root     staff        4096 Sep  9 13:52 home
drwxr-xr-x    2 root     root         4096 Sep  9 19:38 initrd
lrwxrwxrwx    1 root     root           28 Sep 21 16:45 initrd.img -> boot/initr
d.img-2.4.25-1-386
drwxr-xr-x    9 root     root         4096 Sep 10 09:19 lib
drwxr-xr-x    2 root     root        16384 Sep  9 19:34 lost+found
drwxr-xr-x    3 root     root         4096 Sep  9 19:35 media
drwxr-xr-x    2 root     root         4096 Jul 27 03:27 mnt
drwxr-xr-x    2 root     root         4096 Sep  9 19:38 opt
drwxr-xr-x    2 root     root         4096 Jul 27 03:27 proc
drwxr-xr-x    4 root     root         4096 Sep 16 16:05 ramfs
drwxr-xr-x    4 root     root         4096 Sep 15 13:32 root
drwxr-xr-x    2 root     root         4096 Sep 10 09:47 sbin
drwxr-xr-x    2 root     root         4096 Sep  9 19:38 srv
drwxr-xr-x    2 root     root         4096 May 26 03:40 sys
lrwxrwxrwx    1 root     root            9 Sep 21 16:24 tmp -> ramfs/tmp
drwxr-xr-x   12 root     root         4096 Sep 15 13:36 usr
lrwxrwxrwx    1 root     root            9 Sep 21 16:45 var -> ramfs/var
lrwxrwxrwx    1 root     root           25 Sep 21 16:45 vmlinuz -> boot/vmlinuz-
2.4.25-1-386
onlsbc1:/mnt1#

onlsbc1:/mnt1# pwd
/mnt1
onlsbc1:/mnt1# ls sbin/grub
sbin/grub
onlsbc1:/mnt1# ./sbin/grub
Probing devices to guess BIOS drives. This may take a long time.


    GNU GRUB  version 0.95  (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 (hd2,0)
 Filesystem type is ext2fs, partition type 0x83

grub> setup (hd2)
 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 (hd2)"...  16 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd2) (hd2)1+16 p (hd2,0)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.

grub> quit


onlsbc1:/mnt1#

onlsbc1:/mnt1# cd /
onlsbc1:/# umount /mnt1
onlsbc1:/#

	これで 1GBコンパクトフラッシュ上に、CC/NET用のコンパクトフラッシュLinux
	システム、Debian GNU/Linux 3.1 (Sarge) を復旧できた。


---xxxx