上一页 OpenBSD FAQ 第14章-磁盘设置 下一页
14.1--使用OpenBSD的disklable
什么是disklable?
首先阅读disklable(8)的手册页。
disklable被创建来允许提供给磁盘和(在内核里的)磁盘的驱程一个有效的界面。标签(lables)包含你的磁盘的一些信息,像磁盘geometry和你的文件系统信息。这也被启动程序用来载入驱动器和确定文件系统包含在该驱动器的何处。标签也用来联合文件系统来创建更有效的环境。你可以阅读disklable(5)的手册页来了解更深入的信息。
另一个额外的收获是,使用disklable可避免磁盘分区在体系上的限制。比如,在i386体系上,你最多只有4个主分区。使用disklable,你可以使用一个“主分区”来存储你的所有OpenBSD
分区(如'swap',"/",'/usr'和'/var')并且你还有3个主分区用于安装其他的操作系统。
在OpenBSD 安装时使用disklable
OpenBSD 安装的主要一部分是建立磁盘标签。这在fdisk使用之后(for i386 用户)。在安装过程中你使用disklable来创建(包含不同的挂载点的)不同的标签。在安装时,你可以在disklable中设置挂载点,但是这并不是必须考虑的,因为这还会在后面提示你确定你的选择。但是这可使你的安装更顺畅。
因为这是在没有任何已知标签的条件下安装,所以就必须创建标签。你要创建的第一个标签是'a'.此标签必须是/分区的挂载处。你可以阅读FAQ 4 Space Needed来得知建议的分区及其大小的信息。作为服务器,强烈建议你创建那些各自的标签。作为桌面,仅创建一个/的挂载点也是可以的。当创建跟分区时(‘a’标签),一定要注意留下一点空间给swap分区。现在我们已经说明了基本的知识,下面就是在安装时使用disklable的一例。在第一个例子中,假设OpenBSD是你的计算机上的唯一操作系统,所以将使用完全安装。
If this disk is shared with other operating systis, those operating systis
should have a BIOS partition entry that spans the space they occupy completely.
For safety, also make sure all OpenBSD file systis are within the offset and
size specified in the 'A6' BIOS partition table. (By default, the disklabel
editor will try to enforce this). If you are unsure of how to use multiple
partitions properly (ie. separating /, /usr, /tmp, /var, /usr/local, and other
things) just split the space into a root and swap partition for now.
# using MBR partition 3: type A6 off 63 (0x3f) size 4991553 (0x4c2a41)
Treating sectors 63-16386300 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)
> d a
> a a
offset: [63] Enter
size: [16386237] 64M
Rounding to nearest cylinder: 131040
FS type: [4.2BSD] Enter
mount point: [none] /
fragment size: [1024] Enter
block size: [8192] Enter
cpg: [16] Enter
> a b
offset: [131103] Enter
size: [16255197] 64M
Rounding to nearest cylinder: 131040
FS type: [swap] Enter
在此,我们创建了一个挂载在/下的64M的跟分区和一个64M的交换分区。注意offset从63扇区开始。这正是你想要的。到了输入size时,disklable将会以扇区格式显示你的size.但是,你不必以同样的格式输入size.像上例一样,你可以按类似方式输入size:64
Megabytes=64M, 2 Gigabytes=2G。disklable会转到最近的柱面。在上例中,你也会注意到disklable假定标签“b”为交换分区。这是一个正确的假设,因为GENERIC内核也被设置为在标签“b”上寻找交换分区,并且你应该遵守这些规则并使用"b"作为你的交换区。
下面的将会再创建两个标签。这意味着这并非一个完全安装,因为它们的大小不适合OpenBSD的完全安装。显示所有分区的创建仅仅是无聊的重复。
> a d
offset: [262143] Enter
size: [16124157] 64M
Rounding to nearest cylinder: 131040
FS type: [4.2BSD] Enter
mount point: [none] /tmp
fragment size: [1024] Enter
block size: [8192] Enter
cpg: [16] Enter
> a e
offset: [393183] Enter
size: [15993117] 64M
Rounding to nearest cylinder: 131040
FS type: [4.2BSD] Enter
mount point: [none] /var
fragment size: [1024] Enter
block size: [8192] Enter
cpg: [16] Enter
在上例中,有两点你可能会注意到。一个是offset会在你一步中自动给出。此类型的安装,你没有必要因为改变offset而混乱。另一个就是"c"标签被跳过了。这是有原因的,因为标签“c”代表整个磁盘。基于这点,你无论如何不能删除标签“c”.
所有的标签都创建后,剩下的就是将标签写如磁盘,并进入到安装进程的下一步。写入所有东西并退出(并继续安装):
> w
> q
注意:-给使用大磁盘的人。如果你的bios不支持某大小的分区,那么OpenBSD也不支持它。否则,OpenBSD将能很好的处理你的磁盘。如果你遇到你的bios不支持你的驱动器的情况,你可以试试Maxtor
EZ-Drive或者其他类似的产品。
disklable的一般使用
一旦你的系统已安装,你就没必要经常的使用disklable了。但是有时你也需要使用disklable来增加、删除或者调整你的磁盘。你需要做的第一件事就是察看你当前的disklable.那么,你只要简单的输入:
# disklabel wd0 >----- 或者其他任何你想查看的磁盘设备
# using MBR partition 3: type A6 off 64 (0x40) size 16777152 (0xffffc0)
# /dev/rwd0c:
type: ESDI
disk:
label: TOSHIBA MK2720FC
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 2633
total sectors: 2654064
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
16 partitions:
# size offset fstype [fsize bsize cpg]
a: 2071440 65583 4.2BSD 1024 8192 16 # (Cyl. 65*- 2120)
b: 65520 63 swap # (Cyl. 0*- 65)
c: 2654064 0 unused 0 0 # (Cyl. 0 - 2632)
j: 512001 2137023 4.2BSD 1024 8192 16 # (Cyl. 2120*- 2627*)
上面的命令只是简单的查看已知的磁盘标签,并假设你不需要弄糟任何东西。但是为了进行修改,你需要在disklable 中使用-E选项,比如: # disklabel
-E wd0
这将把你带到一个和OpenBSD安装时一样的提示符下。也许该提示符下最重要的一个命令是"?"。这将会给出disklable可用的所有参数的列表。你可可以使用"M"命令来查看整个的disklable(8)的手册页。在此提示符下,你可以完成所有的增加、删除、修改分区。参阅disklable(8)的手册页来获得更多的信息。
上一页 目录 下一页