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