Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1830610
  • 博文数量: 237
  • 博客积分: 9995
  • 博客等级: 中将
  • 技术积分: 2890
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-30 10:33
文章分类

全部博文(237)

文章存档

2011年(1)

2007年(59)

2006年(177)

我的朋友

分类: BSD

2006-06-23 10:33:48

OpenBSD全能服务器安装手册之系统安装篇

--关于fdisk的一些介绍

 

 Disk: wd0       geometry: 1 2586/2 240/3 63 [4 39100320 Sectors]

//注释:上面这一行显示你硬盘的一些基本信息,显示的是openbsd下的fdisk所认为的你的硬盘尺寸。按照fdisk,你的硬盘有1 2586个柱面(cylinder[0-2585]2 240head[0-239]3 每个磁道(track)有63个扇区(sector[1-63]。硬盘总共有4 39100320个扇区,有趣的是,fdisk显示的4和其他工具显示的一样。

  Offset: 0       Signature: 0xAA55

           Starting                                  Ending                LBA Info:

   #:       id        C     H    S   -       C       H        S [       start:      size   ]

  ------------------------------------------------------------------------

  *1 0: 2 0B    3 0   4 1  5 1 -  6 202 7 239 8 63 [          63:     3069297 ] 9 Win95 FAT-32

       1:    00       0      0     0 -       0        0        0 [           0:           0 ] unused

       2:    00       0      0     0 -       0        0        0 [           0:           0 ] unused

       3:    00       0      0     0 -       0        0        0 [           0:           0 ] unused

  Enter 'help' for information

//注释:1显示的是MBR分区数字,从032显示的是分区id,分区id用十六进制数来表示这个分区上的文件系统,0x0B分区id标示的是fat32文件系统;345分别表示这个分区开始于3所显示的cylinder4所显示的head5所显示的sector;看到这里你就会明白,Ccylinder的缩写,Hhead的缩写,Ssector的缩写。同样,678表示的是这个分区结束位置的CHS9用英语清晰的表明了这个分区的文件类型。也许你会注意到,第一个分区开始chs位置是0-1-1,为什么不是从0-0-1开始的呢?因为从0-0-10-0-63是零磁道,默认被MBR和其他东西?占用了。

  fdisk: 1> help   //注:在fdisk启动后,在其提示符后输入相应的命令然后回车,可以进行相应的操作,这里输入help,下面将会显示帮助信息。在下面的注释中,标记为重要的,是常用的命令,请你现在就记住,其他的如果你不想,可以等以后慢慢了解实践

          help            Command help list   //注: 重要,显示帮助信息

          manual          Show entire OpenBSD man page for fdisk  //注:显示openbsdfdisk的全部手册页

          reinit          Re-initialize loaded MBR (to defaults)   // 注:重要,清除已存的分区表,建立一个大的OpenBSD分区,并标记它为active。等同于在"use *all* of ..."时回答"yes"

          setpid          Set the identifier of a given table entry  //注:设定分区文件类型的id

          disk            Edit current drive stats  //注:编辑当前硬盘状态

          edit            Edit given table entry  //注:重要,编辑或者改变分区表项

          flag            Flag given table entry as bootable  //注:重要,标记某分区为活动(active)分区,系统从该分区启动

          update          Update machine code in loaded MBR  //注:在加载MBR时,升级机器码

          select          Select extended partition table entry MBR  //注:选择扩展的分区表入口MBR

          swap            Swap two partition entries  //注:交换两个分区的入口

          print           Print loaded MBR partition table  //注:重要,按扇区显示出当前的分区表。 "p m"将以兆字节(MB)格式显示分区表."p g"以吉字节(gigabytes)显示分区表

          write           Write loaded MBR to disk  //注:重要,把载入的MBR写回磁盘

          exit            Exit edit of current MBR, without saving changes  //注:重要,退出当前的MBR编辑,并且对任何改变不保存。

          quit            Quit edit of current MBR, saving current changes  //注:重要,退出当前的MBR编辑,并且保存改变的内容。

          abort           Abort program without saving current changes  //注:中止程序,并且不保存当前的改变

  fdisk: 1>

 

 

 

 

需要重申的是,这里出现任何错误都将导致严重的数据丢失。假如你要在有重要数据的计算机上做这些,最好能在一个无关紧要的盘上进行练习,另外要注意先备份。

 

     这里我们有1.5G分区是Windows2000(使用FAT文件系统)。看到上面显示的信息,我们可以发现windows分区占据了硬盘上0202柱面,我们将剩下的分区分配给OpenBSD,从203柱面开始。你也可以计算出OpenBSD的起始扇区为3069360.(已知分区的起始扇区63加上它的大小3069297).

 

      你可以以柱面/(Headers)/扇区格式来编辑分区布局或者调整raw扇区。哪个更容易些取决于你要做什么。此例对以已知分区进行处理,用CHS格式可能会容易些。

 

 

7

  fdisk: 1> e 1  //注:eedit的简写,这句的意思是编辑分区1 ,下面还用到了其他命令的简写,就不再一一作注释了,下面粗体的需要你输入的内容,为什么要输入这些东西,请用以前的知识在实践中加以体会。

           Starting       Ending       LBA Info:

   #: id    C   H  S -    C   H  S [       start:      size   ]

  ------------------------------------------------------------------------

   1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

  Partition id ('0' to disable)  [0 - FF]: [0] (? for help) a6

  Do you wish to edit in CHS mode? [n] y

  BIOS Starting cylinder [0 - 2585]: [0] 203

  BIOS Starting head [0 - 239]: [0] 回车

  BIOS Starting sector [1 - 63]: [0] 1

  BIOS Ending cylinder [0 - 2585]: [0] 2585

  BIOS Ending head [0 - 239]: [0] 239

  BIOS Ending sector [1 - 63]: [0] 63

  fdisk:*1> p

  Disk: wd0       geometry: 2586/240/63 [39100320 Sectors]

  Offset: 0       Signature: 0xAA55

           Starting       Ending       LBA Info:

   #: id    C   H  S -    C   H  S [       start:      size   ]

  ------------------------------------------------------------------------

  *0: 0B    0   1  1 -  202 239 63 [          63:     3069297 ] Win95 FAT-32

   1: A6  203   0  1 - 2585 239 63 [     3069360:    36030960 ] OpenBSD

   2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

   3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

  fdisk:*1> p m

  Disk: wd0       geometry: 2586/240/63 [19092 Megabytes]

  Offset: 0       Signature: 0xAA55

           Starting       Ending       LBA Info:

   #: id    C   H  S -    C   H  S [       start:      size   ]

  ------------------------------------------------------------------------

  *0: 0B    0   1  1 -  202 239 63 [          63:        1499M] Win95 FAT-32

   1: A6  203   0  1 - 2585 239 63 [     3069360:       17593M] OpenBSD

   2: 00    0   0  0 -    0   0  0 [           0:           0M] unused

   3: 00    0   0  0 -    0   0  0 [           0:           0M] unused

  fdisk:*1>

 

 

 

注意,提示符如果变为一个带*号的,说明你的修改没有被保存。从上面的p m输出可以看出,我们没有改变windows分区,我们成功的将剩余分区分配给了OpenBSD,并且分区无交迭。

 

我们还没做的是标记某分区为活动分区active,这样计算机才能在下次重启时启动OpenBSD

 

 

 

 

 

 

  fdisk:*1> f 1   //注:把分区一设置为活动分区,这样,你的计算机启动时就会直接启动openbsd,但是你的windows就启动不起来了,若你还想启动win,就不需要这个命令,然后你可以参照后面的多系统安装这一节内容,若是你现在用了这个命令,也没关系,op重启后,用fdisk把分区0重新设置成活动的,这样win就能启动起来了。

  Partition 1 marked active.

  fdisk:*1> p

  Disk: wd0       geometry: 2586/240/63 [39100320 Sectors]

  Offset: 0       Signature: 0xAA55

           Starting       Ending       LBA Info:

   #: id    C   H  S -    C   H  S [       start:      size   ]

  ------------------------------------------------------------------------

   0: 0B    0   1  1 -  202 239 63 [          63:     3069297 ] Win95 FAT-32

  *1: A6  203   0  1 - 2585 239 63 [     3069360:    36030960 ] OpenBSD

   2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

   3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

  fdisk:*1>

 

9QUOTE:

  fdisk:*1> w

  Writing MBR at offset 0.

  wd0: no disk label

  fdisk: 1> q

 

创建磁盘卷标(disklabel)

 

    下一步就是使用disklable(OpenBSD Slice细分成不同文件系统的分区,disklable被创建来允许提供给磁盘和(在内核里的)磁盘的驱程一个有效的界面。标签(lables)包含你的磁盘的一些信息,像磁盘geometry和你的文件系统信息。这也被启动程序用来载入驱动器和确定文件系统包含在该驱动器的何处。标签也用来联合文件系统来创建更有效的环境。你可以阅读disklable(5)的手册页来了解更深入的信息。

 

    另一个额外的收获是,使用disklable可避免磁盘分区在体系上的限制。比如,在i386体系上,你最多只有4个主分区。使用disklable,你可以使用一个“主分区”来存储你的所有OpenBSD 分区('swap',"/",'/usr''/var')并且你还有3个主分区用于安装其他的操作系统。

 

 

QUOTE:

  Here is the partition information you chose:

 

  Disk: wd0       geometry: 2586/240/63 [39100320 Sectors]

  Offset: 0       Signature: 0xAA55

           Starting       Ending       LBA Info:

   #: id    C   H  S -    C   H  S [       start:      size   ]

  ------------------------------------------------------------------------

   0: 0B    0   1  1 -  202 239 63 [          63:     3069297 ] Win95 FAT-32

  *1: A6  203   0  1 - 2585 239 63 [     3069360:    36030960 ] OpenBSD

   2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

   3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused

 

  You will now create an OpenBSD disklabel inside the OpenBSD MBR

  partition. The disklabel defines how OpenBSD splits up the MBR partition

  into OpenBSD partitions in which filesystems and swap space are created.

 

  The offsets used in the disklabel are ABSOLUTE, i.e. relative to the

  start of the disk, NOT the start of the OpenBSD MBR partition.

 

  disklabel: no disk label

  WARNING: Disk wd0 has no label. You will be creating a new one.

 

  # using MBR partition 1: type A6 off 3069360 (0x2ed5b0) size 36030960 (0x225c9f0)

 

  Treating sectors 3069360-39100320 as the OpenBSD portion of the disk.

  You can use the 'b' command to change this.

 

  Initial label editor (enter '?' for help at any prompt)

  > ?    //输入?显示下面的帮助信息

  Available commands:

          ? [cmnd]  - this message or command specific help.

          a [part]  - add new partition.  //增加一个新分区

          b         - set OpenBSD disk boundaries.

          c [part]  - change partition size.

          D         - set label to default.  //清除所有存在的disklabel,创建一个仅仅适合于当前openbsd分区的默认disklabel。硬盘上原先已经有disklabel,但是后来又重建了分区并改变了分区大小,原先的disklabel并不会消失,这样会引起混乱,这时候用这个命令就非常好。

          d [part]  - delete partition.  //删除分区

          e         - edit drive parameters.

          g [b|d|u] - use bios, disk or user geometry.

          M         - show entire OpenBSD man page for disklabel.

          m [part]  - modify existing partition.  //编辑已经存在的分区

          n [part]  - set the mount point for a partition.

          p [unit]  - print label.  //显示当前的disklabel,并且你可以在其后面加上修饰字符km或者g使其以千字节、兆字节或十亿字节的格式显示其结果。

          q         - quit and save changes.  //退出并且保存所有的改变

          r         - recalculate free space.

          s [path]  - save label to file.

          u         - undo last change.

          w         - write label to disk.  //disklabel写回硬盘

          X         - toggle expert mode.

          x         - exit without saving changes.  //退出并且不保存改变

          z         - zero out partition table.

  Numeric parameters may use suffixes to indicate units:

          'b' for bytes, 'c' for cylinders, 'k' for kilobytes, 'm' for megabytes,

          'g' for gigabytes or no suffix for sectors (usually 512 bytes).

          '%' for of total disk size, '&' for percent of free space.

          Non-sector units will be rounded to the nearest cylinder.

  Entering '?' at most prompts will give you (simple) context sensitive help.  //上面这段话很有用,大概意思是:数字参数可以使用后缀来表明其单位:“b”代表字节,“c”代表柱面,“k”代表千字节,“m”代表兆字节,“g”代表十亿字节,或者没有后缀则代表扇区(一般情况下是512字节)。“%”代表整个硬盘的百分比,“&”代表剩余空间的百分比。

  >

在根硬盘,“a”和“b”分区必须被建立,若不然,安装程序将不会继续进行,“a”用于root文件系统(/),“b”用于交换空间。

在下面的例子中,我们将把/, /tmp, /var, /usr, /home这几个分区的大小设置为:

wd0a: / (root) - 150M.

wd0b: (swap) - 300M.

wd0d: /tmp - 120M.

wd0e: /var - 80M.

wd0g: /usr - 3G.

wd0h: /home - 4G.

 

 

QUOTE:

  > p m  //以兆字节为单位显示当前disklabel

阅读(2108) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~