| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1481 人关注过本帖
标题:用u盘制作应急盘[ 转载]
只看楼主 加入收藏
guixiaolan
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:356
专家分:0
注 册:2006-4-20
收藏
 问题点数:0 回复次数:0 
用u盘制作应急盘[ 转载]
######################第1步 内核加入u盘
#插入u盘
sco_200:root[/] 168 $ mkdev hd

Your root hard disk is attached to an IDE controller.

Pick one of the choices below or you may quit and
invoke mkdev hd -u for a detailed usage message.

                1) Add a hard disk to an IDE controller
                2) Add a hard disk to a SCSI controller
                3) Add a hard disk to an IDA controller (EISA)
                4) Add a hard disk to a  USB controller

Enter 1, 2, 3, 4 or enter 'q' to quit: 4

The Host Adapter parameters will be automatically configured

What is the USB Device ID for this device?
Select 0-15, or h for help, or q to quit: 0

What is the LUN of this device?
Press <Return> to use the default: 0
Select 0-7, or h for help, or q to quit: 0

Disk already configured as disk number 1 (/dev/dsk/1s0)

During installation you may choose to overwrite all
or part of the present contents of your hard disk.

Do you wish to continue? (y/n) y
#如果没有出现During installation you may choose to overwrite all,而要求重新连接内核,请按提示操作重新连接内核,然后重启动后,再mkdev hd


The hard disk installation program will now invoke /etc/fdisk.
Entering 'q' at the following menu will exit /etc/fdisk,
and the hard disk installation will continue.

If you wish to exit the entire installation at this menu,
press the <DEL> key.

####################### 第2步 不必须,最好确认一下
用hwconfig确认一下内核连上的u盘驱动,并检测到u盘
sco_200:root[/] 174 $ hwconfig |egrep "disk|Sdsk"
name=disk base=0x1F0 offset=0x7 vec=14 dma=- type=W0/0 unit=0 cyls=1044 hds=255 secs=63
name=disk vec=- dma=- type=S ha=0 id=0 lun=0 bus=0 ht=usb_msto unit=0
name=Sdsk vec=- dma=- cyls=3904 hds=2 secs=32 unit=0
name=Sdsk-0 vec=- dma=- Vnd=USB Prd=Flash Disk Rev=2.00
#########容量确认:cyls=3904 * hds=2 * secs=32 * 512 = u盘容量
sco_200:root[/] 175 $ l /dev/hd?0
brw-------   1 root     root       1,  0 Feb 18  2003 /dev/hd00
brw-------   1 sysinfo  sysinfo   45,  0 Jun  4 23:08 /dev/hd10
brw-------   1 sysinfo  sysinfo    1, 64 Jul  8  2007 /dev/hd20
sco_200:root[/] 176 $ fdisk -f /dev/rhd10
        1. Display Partition Table
        2. Use Entire Disk for UNIX
        3. Use Rest of Disk for UNIX
        4. Create UNIX Partition
        5. Activate Partition
        6. Delete Partition
        7. Create Partition
Enter your choice or 'q' to quit: 1
Current Hard Disk Drive: /dev/rhd10
        +-------------+----------+-----------+---------+---------+---------+
        | Partition   | Status   | Type      |   Start |     End |    Size |
        +-------------+----------+-----------+---------+---------+---------+
        | 1           | Active   | UNIX      |       1 |    7805 |    7805 |
        +-------------+----------+-----------+---------+---------+---------+
Total disk size: 7808 tracks (3 reserved for masterboot and diagnostics)
#分区表内容无所谓,确认容量:7808 tracks = cyls磁道数3904 * hds磁头数2
#如果不是hd10,试试hd20 ......
#试试读盘操作,确认后u盘灯闪后可del中断,count=有无及大小不重要:
sco_200:root[/] 179 $ dd if=/dev/rhd10 of=/dev/null count=500
120+0 records in
120+0 records out

####################第3步 写主引导区
#千万别写错盘,错了你的系统会被彻底破坏!!!
sco_200:root[/] 182 $ dd if=/etc/masterboot of=/dev/rhd10
0+1 records in
0+1 records out

###################第4步 分区
#千万别写错盘,错了你的系统会被彻底破坏!!!
#分区表不对就删除所有分区,重新生成unix分区,并激活它.
sco_200:root[/] 183 $ fdisk -f /dev/rhd10
        1. Display Partition Table
        2. Use Entire Disk for UNIX
        3. Use Rest of Disk for UNIX
        4. Create UNIX Partition
        5. Activate Partition
        6. Delete Partition
        7. Create Partition
Enter your choice or 'q' to quit: 1
Current Hard Disk Drive: /dev/rhd10
        +-------------+----------+-----------+---------+---------+---------+
        | Partition   | Status   | Type      |   Start |     End |    Size |
        +-------------+----------+-----------+---------+---------+---------+
        +-------------+----------+-----------+---------+---------+---------+
Total disk size: 7808 tracks (3 reserved for masterboot and diagnostics)
Enter partition number or 'q' to return: 1
Enter starting track number, or 'q' to return: 1
Enter partition size in tracks, or 'q' to return: 7805 (总7808-3=7805)
Warning!  Your UNIX partition is not on a cylinder boundary.  You may want
to place it on a cylinder boundary to accomodate other operating systems.
Starting at track 2 and using a size of 7802 tracks will place your
partition on a cylinder boundary.
Current Hard Disk Drive: /dev/rhd10
        +-------------+----------+-----------+---------+---------+---------+
        | Partition   | Status   | Type      |   Start |     End |    Size |
        +-------------+----------+-----------+---------+---------+---------+
        | 1           | Inactive | UNIX      |       1 |    7805 |    7805 |
        +-------------+----------+-----------+---------+---------+---------+
Total disk size: 7808 tracks (3 reserved for masterboot and diagnostics)
Press <Return> to continue
        1. Display Partition Table
        2. Use Entire Disk for UNIX
        3. Use Rest of Disk for UNIX
        4. Create UNIX Partition
        5. Activate Partition
        6. Delete Partition
        7. Create Partition
Enter your choice or 'q' to quit: 5
Current Hard Disk Drive: /dev/rhd10
        +-------------+----------+-----------+---------+---------+---------+
        | Partition   | Status   | Type      |   Start |     End |    Size |
        +-------------+----------+-----------+---------+---------+---------+
        | 1           | Inactive | UNIX      |       1 |    7805 |    7805 |
        +-------------+----------+-----------+---------+---------+---------+
Total disk size: 7808 tracks (3 reserved for masterboot and diagnostics)
Enter partition number you want to make active, or `q' to return: 1
        1. Display Partition Table
        2. Use Entire Disk for UNIX
        3. Use Rest of Disk for UNIX
        4. Create UNIX Partition
        5. Activate Partition
        6. Delete Partition
        7. Create Partition
Enter your choice or 'q' to quit: 1
Current Hard Disk Drive: /dev/rhd10
        +-------------+----------+-----------+---------+---------+---------+
        | Partition   | Status   | Type      |   Start |     End |    Size |
        +-------------+----------+-----------+---------+---------+---------+
        | 1           | Active   | UNIX      |       1 |    7805 |    7805 |
        +-------------+----------+-----------+---------+---------+---------+
Total disk size: 7808 tracks (3 reserved for masterboot and diagnostics)
Press <Return> to continue
        1. Display Partition Table
        2. Use Entire Disk for UNIX
        3. Use Rest of Disk for UNIX
        4. Create UNIX Partition
        5. Activate Partition
        6. Delete Partition
        7. Create Partition
Enter your choice or 'q' to quit: q

#######################第5步 写活动分区引导信息
#千万别写错盘,错了你的系统会被彻底破坏!!!
sco_200:root[/] 184 $ l /dev/hd1?
brw-------   1 sysinfo  sysinfo   45,  0 Jun  4 23:08 /dev/hd10
brw-------   1 sysinfo  sysinfo   45, 15 Jun  4 23:08 /dev/hd11
brw-------   1 sysinfo  sysinfo   45, 23 Jun  4 23:08 /dev/hd12
brw-------   1 sysinfo  sysinfo   45, 31 Jun  4 23:08 /dev/hd13
brw-------   1 sysinfo  sysinfo   45, 39 Jun  4 23:08 /dev/hd14
brw-------   1 sysinfo  sysinfo   45, 47 Jun  4 23:08 /dev/hd1a
brw-r-----   1 dos      sysinfo   45, 48 Jun  4 23:08 /dev/hd1d
#确认hd1a与hd10主设备号相同(45),子设备号差47
sco_200:root[/] 186 $ dd if=/etc/hdboot0 of=/dev/hd1a
1+0 records in
1+0 records out
sco_200:root[/] 187 $ dd if=/etc/hdboot1 of=/dev/hd1a oseek=1
35+1 records in
35+1 records out

#########################第6步 划文件系统
#千万别写错盘,错了你的系统会被彻底破坏!!!
sco_200:root[/] 194 $ divvy -m /dev/rhd1aoot[/] 194 $
+-------------------+------------+--------+---+-------------+------------+
| Name              | Type       | New FS | # | First Block | Last Block |
+-------------------+------------+--------+---+-------------+------------+
| hd1aboot          | EAFS       |  no    | 0 |            0|      116878|
|                   | NOT USED   |  no    | 1 |            -|           -|
|                   | NOT USED   |  no    | 2 |            -|           -|
|                   | NOT USED   |  no    | 3 |            -|           -|
|                   | NOT USED   |  no    | 4 |            -|           -|
|                   | NOT USED   |  no    | 5 |            -|           -|
|                   | NOT USED   |  no    | 6 |            -|           -|
| d45057all         | WHOLE DISK |  no    | 7 |            0|      124879|
+-------------------+------------+--------+---+-------------+------------+
116879 1K blocks for divisions, 8001 1K blocks reserved for the system
 n[ame]       Name or rename a division.
 c[reate]     Create a new file system on this division.
 d[elete]     Delete a file system on this division.
 t[ype]       Select or change filesystem type on new filesystems.
 p[revent]    Prevent a new file system from being created on this division.
 s[tart]      Start a division on a different block.
 e[nd]        End a division on a different block.
 r[estore]    Restore the original division table.
Enter your choice or q to quit: n
 which division? (0 through 7)?0
 what do you want to call it? hd1aboot
+-------------------+------------+--------+---+-------------+------------+
| Name              | Type       | New FS | # | First Block | Last Block |
+-------------------+------------+--------+---+-------------+------------+
| hd1aboot          | EAFS       |  no    | 0 |            0|      116878|
|                   | NOT USED   |  no    | 1 |            -|           -|
|                   | NOT USED   |  no    | 2 |            -|           -|
|                   | NOT USED   |  no    | 3 |            -|           -|
|                   | NOT USED   |  no    | 4 |            -|           -|
|                   | NOT USED   |  no    | 5 |            -|           -|
|                   | NOT USED   |  no    | 6 |            -|           -|
| d45057all         | WHOLE DISK |  no    | 7 |            0|      124879|
+-------------------+------------+--------+---+-------------+------------+
116879 1K blocks for divisions, 8001 1K blocks reserved for the system
 n[ame]       Name or rename a division.
 c[reate]     Create a new file system on this division.
 d[elete]     Delete a file system on this division.
 t[ype]       Select or change filesystem type on new filesystems.
 p[revent]    Prevent a new file system from being created on this division.
 s[tart]      Start a division on a different block.
 e[nd]        End a division on a different block.
 u[ndo]       Undo the last change.
 r[estore]    Restore the original division table.
Enter your choice or q to quit: c
 which division? (0 through 6)?0
+-------------------+------------+--------+---+-------------+------------+
| Name              | Type       | New FS | # | First Block | Last Block |
+-------------------+------------+--------+---+-------------+------------+
| hd1aboot          | HTFS       |  yes   | 0 |            0|      116878|
|                   | NOT USED   |  no    | 1 |            -|           -|
|                   | NOT USED   |  no    | 2 |            -|           -|
|                   | NOT USED   |  no    | 3 |            -|           -|
|                   | NOT USED   |  no    | 4 |            -|           -|
|                   | NOT USED   |  no    | 5 |            -|           -|
|                   | NOT USED   |  no    | 6 |            -|           -|
| d45057all         | WHOLE DISK |  no    | 7 |            0|      124879|
+-------------------+------------+--------+---+-------------+------------+
116879 1K blocks for divisions, 8001 1K blocks reserved for the system
 n[ame]       Name or rename a division.
 c[reate]     Create a new file system on this division.
 d[elete]     Delete a file system on this division.
 t[ype]       Select or change filesystem type on new filesystems.
 p[revent]    Prevent a new file system from being created on this division.
 s[tart]      Start a division on a different block.
 e[nd]        End a division on a different block.
 u[ndo]       Undo the last change.
 r[estore]    Restore the original division table.
Enter your choice or q to quit: t
 which division? (0 through 6)?0
 Choose from the following filesystem types:
 0.  NON FS (overwrite first 64K of filesystem with zeros)
 1.  AFS
 2.  DTFS
 3.  EAFS
 4.  HTFS
 5.  S51K
 6.  XENIX
 Please enter your choice: 3
+-------------------+------------+--------+---+-------------+------------+
| Name              | Type       | New FS | # | First Block | Last Block |
+-------------------+------------+--------+---+-------------+------------+
| hd1aboot          | EAFS       |  yes   | 0 |            0|      116878|
|                   | NOT USED   |  no    | 1 |            -|           -|
|                   | NOT USED   |  no    | 2 |            -|           -|
|                   | NOT USED   |  no    | 3 |            -|           -|
|                   | NOT USED   |  no    | 4 |            -|           -|
|                   | NOT USED   |  no    | 5 |            -|           -|
|                   | NOT USED   |  no    | 6 |            -|           -|
| d45057all         | WHOLE DISK |  no    | 7 |            0|      124879|
+-------------------+------------+--------+---+-------------+------------+
116879 1K blocks for divisions, 8001 1K blocks reserved for the system
#文件系统0结束位置小于总分区大小(不含保留区)
 n[ame]       Name or rename a division.
 c[reate]     Create a new file system on this division.
 d[elete]     Delete a file system on this division.
 t[ype]       Select or change filesystem type on new filesystems.
 p[revent]    Prevent a new file system from being created on this division.
 s[tart]      Start a division on a different block.
 e[nd]        End a division on a different block.
 u[ndo]       Undo the last change.
 r[estore]    Restore the original division table.
Enter your choice or q to quit: q

 i[nstall]      Install the division set-up shown
 r[eturn]       Return to the previous menu
 e[xit]         Exit without installing a division table
Please enter your choice: i
Making filesystems

#################第7步:虚拟2.88M软盘
cd /dev
mv fd0135ds36 fd0135ds36.std
mv rfd0135ds36 rfd0135ds36.std
>/tmp/fd288
marry -a /tmp/fd288
ls -l /dev/marry/tmp/fd288
brw-r--r--   1 root     sys       76,  1 Jul  6 22:51 /dev/marry/tmp/fd288
mknod fd0135ds36 b 76 1
mknod rfd0135ds36 c 76 1
#设备号与前面列出的相同
#################第8步 mkdev fd生成应急盘根文件系统
mkdev fd
        1. Filesystem
        2. Emergency Boot and Root floppy filesystems

Enter an option or q to quit: 2

        Choices for type of floppy filesystem.

        1.  96tpi, double sided, 15 sectors per track (1.2M 5.25 inch)
        2. 135tpi, double sided, 18 sectors per track (1.44M 3.5 inch)
        3. 135tpi, double sided, 36 sectors per track (2.88M 3.5 inch)
        4. 135tpi, double sided, 21 sectors per track (1.68M 3.5 inch)

Enter an option or q to quit: 3

Please choose the type of filesystem.

        1. Root filesystem
        2. Boot filesystem
        3. Single floppy Boot and Root filesystem (2.88M only)
        4. Root filesystem with network utilities
        5. Single floppy Boot and Root filesystem + network utils (2.88M only)

If you have high density (1.44M) disks, you must create separate root
and boot filesystem floppies. The root floppy must be prepared first.

If you have extra density (2.88M) disks, you can choose to have both
the root and boot filesystems on the same floppy disk.

Enter an option or q to quit: 1

Would you like to format the floppy first? (y/n) y


Copying files to RAM Disk ...

Saving /dev/cmos to file /etc/bootroot.d/mnt/etc/cmos.root

Do you want to place extra files on the root filesystem? (y/n) y
<bootroot>mount
/ on /dev/root read/write on Fri Jul 06 22:44:58 2007
/stand on /dev/boot read only on Fri Jul 06 22:44:58 2007
/u on /dev/u read/write on Fri Jul 06 22:45:13 2007
/etc/bootroot.d/mnt on /dev/marry/etc/bootroot.d/ramdisk read/write on Fri Jul 06 22:57:19 2007
cd /etc/bootroot.d/mnt
#拷自己需要的其它文件
#但后面可能会空间不够,需要的话要从/etc/bootroot.d/mnt删掉一些文件如:etc/badtrk etc/emulator
#下面这一步是为了将没用的空间,用空格填满,便于提高压缩效果
echo "                                                                                                                                             ">temp.txt
dd if=temp.txt bs=140 count=100>>temp.txt
dd if=temp.txt bs=14k count=200>>temp.txt
#验证文件系统是否100%满了:
df -kvt .
rm temp.txt
<bootroot>exit

Please choose the boot floppy style.

        1. System specific boot
        2. Generic boot (builds a special kernel)
        3. System specific boot with networking enabled
           (Current system must have functional network)

The System specific boot floppy can only boot the machine it was created on.

The Generic boot floppy can be used to boot any machine.

Enter an option or q to quit: q

#################第9步 将应急盘根文件系统ramdisk.Z复制到硬盘boot区
mount /dev/fd0135ds36 /mnt
cd /mnt
l
-rw-r--r--   1 root     sys      1688634 Jul  6 23:14 ramdisk.Z
umount /stand
mount /stand
cp ramdisk.Z /stand


##################第10步 复制文件到u盘
mount /dev/hd1aboot /mnt
cd /stand
find . -depth -mount -print |cpio -puvdm /mnt
#复制其它需要的文件到u盘,如硬盘驱动
cd /
umount /mnt

#################第11步 应急u盘使用:
#插上u盘,重启动计算机,选择u盘启动(需主板支持)
#可指定使用软盘fd(64)或fd(60)、硬盘boot区hd(104)、u盘hd(40)中的unix、ramdsik.Z、硬盘驱动
#不需要连接硬盘驱动直接启动到应急系统的情况:
boot:unix ramdisk=ramdisk.Z ram.preload=7 root=ram(7) dump=none swap=none
#内核不含硬盘驱动,需要连接光盘上的u盘驱动(假定为ips)再引导应急系统的引导串:
boot:unix.Z ramdisk=ramdisk.Z ram.preload=7 root=ram(7) link=ips Sdsk=ips(0,0,0,0) Srom=wd(0,0,0,0)  dump=none swap=none
#从u盘上连接硬盘驱动,使用硬盘上的unix.install(有的机器连接硬盘驱动后内存出错,换用unix.install或unix.safe可能就能通过):
boot: hd(104)unix.install ramdisk=ramdisk.Z ram.preload=7 root=ram(7) link=ips Sdsk=ips(0,0,0,0) Srom=wd(0,0,0,0)  dump=none swap=none
#应急u盘引导,使用光盘上的内核,连光盘引导区上的硬盘驱动ips进入正常root系统:
boot: unix.Z  root=hd(42) link=ips Sdsk=ips(0,0,0,0) Srom=wd(0,0,0,0)  dump=none swap=hd(41)
#说明:u盘启动时,boot初期hd(40)是u盘,hd(104)是硬盘;boot后期相反,hd(40)是硬盘,hd(104)是u盘

[[it] 本帖最后由 guixiaolan 于 2008-6-23 01:23 编辑 [/it]]
搜索更多相关主题的帖子: vsFTPd 服务器 入门 
2008-06-23 01:18
快速回复:用u盘制作应急盘[ 转载]
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021043 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved