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