Annotation of src/sbin/fdisk/fdisk.8, Revision 1.5
1.5 ! jtc 1: .\" $Id: fdisk.8,v 1.4 1994/01/14 02:05:47 jtc Exp $ -*- nroff -*-
1.1 cgd 2: .Dd April 4, 1993
3: .Dt FDISK 8
4: .\".Os BSD 4
5: .Sh NAME
6: .Nm fdisk
1.5 ! jtc 7: .Nd DOS partition maintenance program
1.1 cgd 8: .Sh SYNOPSIS
9: .Nm
10: .Op Fl i
11: .Op Fl u
12: .Bl -tag -width time
13: .It Fl i
14: Initializes sector 0 of the disk.
15: .It Fl u
16: Is used for updating (editing) sector 0 of the disk.
17: .El
18: .Sh PROLOGUE
19: In order for the BIOS to boot the kernel,
20: certain conventions must be adhered to.
21: Sector 0 of the disk must contain boot code,
22: a partition table,
23: and a magic number.
24: BIOS partitions can be used to break the disk up into several pieces.
25: The BIOS brings in sector 0
26: (does it really use the code?)
27: and verifies the magic number.
28: It then searches the 4 BIOS partitions described by sector 0
29: to determine which of them is
30: .Em active.
31: This boot then brings in the secondary boot block from the
32: .Em active
33: partition and runs it.
34: Under DOS,
35: you could have one or more partitions with one
36: .Em active.
37: The DOS
38: .Nm
39: program can be used to divide space on the disk into partitions and set one
40: .Em active.
41: .Sh DESCRIPTION
1.3 cgd 42: The NetBSD program
1.1 cgd 43: .Nm
44: serves a similar purpose to the DOS program.
45: When called with no arguments, it prints the sector 0 partition table.
46: An example follows:
47:
48: .Bd -literal
49: ******* Working on device /dev/rwd0d *******
50: parameters extracted from in-core disklabel are:
51: cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
52:
53: parameters to be used for BIOS calculations are:
54: cylinders=769 heads=15 sectors/track=33 (495 blks/cyl)
55:
56: Warning: BIOS sector numbering starts with sector 1
57: Information from DOS bootblock is:
58: The data for partition 0 is:
1.3 cgd 59: sysid 165,(NetBSD)
1.1 cgd 60: start 495, size 380160 (185 Meg), flag 0
61: beg: cyl 1/ sector 1/ head 0;
62: end: cyl 768/ sector 33/ head 14
63: The data for partition 1 is:
64: sysid 164,(unknown)
65: start 378180, size 2475 (1 Meg), flag 0
66: beg: cyl 764/ sector 1/ head 0;
67: end: cyl 768/ sector 33/ head 14
68: The data for partition 2 is:
69: <UNUSED>
70: The data for partition 3 is:
71: sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach)
72: start 380656, size 224234 (109 Meg), flag 80
73: beg: cyl 769/ sector 2/ head 0;
74: end: cyl 197/ sector 33/ head 14
75: .Ed
76: .Pp
1.4 jtc 77: The disk is divided into three partitions that happen to fill the disk.
1.1 cgd 78: The second partition overlaps the end of the first.
79: (Used for debugging purposes)
80: .Bl -tag -width "cyl, sector and head"
81: .It Em "sysid"
1.3 cgd 82: is used to label the partition. NetBSD reserves the
1.1 cgd 83: magic number 165 decimal (A5 in hex).
84: .It Em "start and size"
85: fields provide the start address
1.4 jtc 86: and size of a partition in sectors.
1.1 cgd 87: .It Em "flag 80"
88: specifies that this is the active partition.
89: .It Em "cyl, sector and head"
90: fields are used to specify the beginning address
1.4 jtc 91: and end address for the partition.
1.1 cgd 92: .It Em "Note:"
93: these numbers are calculated using BIOS's understanding of the disk geometry
94: and saved in the bootblock.
95: .El
96: .Pp
97: The flags
98: .Fl i
99: or
100: .Fl u
1.4 jtc 101: are used to indicate that the partition data is to be updated.
1.1 cgd 102: The
103: .Nm
104: program will enter a conversational mode.
105: This mode is designed not to change any data unless you explicitly tell it to.
106: .Nm
1.4 jtc 107: selects defaults for its questions to guarantee the above behavior.
1.1 cgd 108: .Pp
109: It displays each partition
110: and ask if you want to edit it.
111: If you say yes,
112: it will step through each field showing the old value
113: and asking for a new one.
114: When you are done with a partition,
115: .Nm
116: will display it and ask if it is correct.
117: .Nm
118: will then procede to the next entry.
119: .Pp
120: Getting the
121: .Em cyl, sector,
122: and
123: .Em head
124: fields correct is tricky.
125: So by default,
126: they will be calculated for you;
127: you can specify them if you choose.
128: .Pp
129: After all the partitions are processed,
130: you are given the option to change the
131: .Em active
132: partition.
133: Finally,
134: when the all the data for the first sector has been accumulated,
135: you are asked if you really want to rewrite sector 0.
136: Only if you answer yes,
137: will the data be written to disk.
138: .Pp
139: The difference between the
140: .Fl u
141: flag and
142: .Fl i
143: flag is that
144: the
145: .Fl u
146: flag just edits the fields as they appear on the disk.
147: While the
148: .Fl i
149: flag is used to "initialize" sector 0;
1.3 cgd 150: it will setup the last BIOS partition to use the whole disk for NetBSD;
1.1 cgd 151: and make it active.
152: .Sh NOTES
153: .Pp
154: The automatic calculation of starting cylinder etc. uses
155: a set of figures that represent what the BIOS thinks is the
156: geometry of the drive.
157: These figures are by default taken from the incore disklabel,
1.4 jtc 158: but the program initially gives you an opportunity to change them.
1.1 cgd 159: This allows the user to create a bootblock that can work with drives
160: that use geometry translation under the BIOS.
161: .Pp
162: If you hand craft your disk layout,
1.3 cgd 163: please make sure that the NetBSD partition starts on a cylinder boundary.
1.1 cgd 164: A number of decisions made later may assume this.
165: (This might not be necessary later.)
166: .Pp
167: Editing an existing partition will most likely cause you to
168: lose all the data in that partition.
169: .Pp
170: You should run this program interactively once or twice to see how it works.
171: This is completely safe as long as you answer the last question in the negative.
172: There are subtleties
173: that the program detects
174: that are not fully explained in this manual page.
175: .Sh SEE ALSO
176: .Xr disklabel 8
177: .Sh BUGS
178: One less now, but probably more
CVSweb <webmaster@jp.NetBSD.org>