Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | .Dd April 4, 1993 |
2 | .Dt FDISK 8 | |
3 | .\".Os BSD 4 | |
4 | .Sh NAME | |
5 | .Nm fdisk | |
6 | .Nd DOS partition maintainance program | |
7 | .Sh SYNOPSIS | |
8 | .Nm | |
9 | .Op Fl i | |
10 | .Op Fl u | |
78ed81a3 | 11 | .Op disk |
15637ed4 RG |
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 | |
42 | The 386bsd program | |
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: | |
59 | sysid 165,(386BSD) | |
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 | |
77 | The disk is divided into three parititions that happen to fill the disk. | |
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" | |
82 | is used to label the partition. 386bsd reserves the | |
83 | magic number 165 decimal (A5 in hex). | |
84 | .It Em "start and size" | |
85 | fields provide the start address | |
86 | and size of a parition in sectors. | |
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 | |
91 | and end address for the parititon. | |
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 | |
101 | are used to indicate that the paritition data is to be updated. | |
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 | |
107 | selects defaults for its questions to guarantee the above behaviour. | |
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; | |
150 | it will setup the last BIOS partition to use the whole disk for 386bsd; | |
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, | |
158 | but the program initially gives you an oportunity to change them. | |
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, | |
163 | please make sure that the 386bsd partition starts on a cylinder boundary. | |
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 |