> Disk: sd0     geometry: 3935/64/32 [8060926 Sectors]
> Offset: 0     Signature: 0xAA55
>          Starting       Ending       LBA Info:
>  #: id    C   H  S -    C   H  S [       start:      size   ]
> ------------------------------------------------------------------------
>  0: 0B    0   1 32 - 3935  63 17 [          63:     8060850 ] Win95 FAT-32
>  1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
>  2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
>  3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      

Ah, I now understand.  Windows is assuming that each track has 63 sectors, 
and apparently requires that each partition fills an integer number of 
tracks.  The ending CHS values are chosen so that the maximum number of 
63-sector tracks are filled.

So, to create the appropriate MBR partition for a drive, type the 
following (I assume that the drive is device sd0):


 # fdisk -i -e sd0
 fdisk: sysctl(machdep.bios.diskinfo): Device not configured
 
        -----------------------------------------------------
        ------ ATTENTION - UPDATING MASTER BOOT RECORD ------
        -----------------------------------------------------
 
 Do you wish to write new MBR and partition table? [n] y
 Enter 'help' for information
 fdisk: 1> print
 Disk: sd0      geometry: 3935/64/32 [8060926 Sectors]
 Offset: 0      Signature: 0xAA55
          Starting       Ending       LBA Info:
  #: id    C   H  S -    C   H  S [       start:      size   ]
 ------------------------------------------------------------------------
  0: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
  1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
  2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
 *3: A6    0   1  1 - 3934  63 32 [          32:     8058848 ] OpenBSD     


Take careful note of the total number of sectors (8060926 in this case).  
Let NUM be the number of sectors divided by 63, rounded down to the 
nearest integer.  Then, let SIZE be 
 63*(NUM - 1)
In this example, NUM is 127951 and SIZE is 8060850.  Continue as follows:


 fdisk: 1> edit 3
          Starting       Ending       LBA Info:
  #: id    C   H  S -    C   H  S [       start:      size   ]
 ------------------------------------------------------------------------
 *3: A6    0   1  1 - 3934  63 32 [          32:     8058848 ] OpenBSD     
 Partition id ('0' to disable)  [0 - FF]: [A6] (? for help) 0
 Partition 3 is disabled.
 fdisk:*1> edit 0
          Starting       Ending       LBA Info:
  #: id    C   H  S -    C   H  S [       start:      size   ]
 ------------------------------------------------------------------------
  0: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
 Partition id ('0' to disable)  [0 - FF]: [0] (? for help) 0B
 Do you wish to edit in CHS mode? [n] n
 offset: [0] 63


At the next prompt, enter the number SIZE that we had previously 
calculated.


 size: [0] 8060850
 fdisk:*1> print
 Disk: sd0      geometry: 3935/64/32 [8060926 Sectors]
 Offset: 0      Signature: 0xAA55
          Starting       Ending       LBA Info:
  #: id    C   H  S -    C   H  S [       start:      size   ]
 ------------------------------------------------------------------------
  0: 0B    0   1 32 - 3935  63 17 [          63:     8060850 ] Win95 FAT-32
  1: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
  2: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
  3: 00    0   0  0 -    0   0  0 [           0:           0 ] unused      
 fdisk:*1> quit
 Writing current MBR to disk.


And notice that the 3935 that I could not explain is immediately accounted 
for.  The problem is solved!

Reply via email to