FDISK(8)                                                 FDISK(8)



NAME
       fdisk - examine or change DOS partitioning information

SYNOPSIS
       /usr/sbin/fdisk  <raw-device>  [  inquiry  ]  [ action ] [
       flags ]

DESCRIPTION
       fdisk displays or changes the DOS partition table found in
       the  bootsector  of i386 bootable disks.  If no inquiry or
       action is specified, it is run in interactive mode, allow-
       ing  multiple  changes  to the partition table to be made.
       If an inquiry is specified, the  result  is  displayed  to
       standard  output but no changes to the partition table are
       made.  If an action is requested, the partition table will
       usually  be  modified and fdisk immediately returns.  When
       fdisk is run in interactive mode, no changes to the parti-
       tion  table  are effected until the user explicitly writes
       the changes.


       fdisk modifies only the bootsector and (unless the  -boot-
       sectorOnly  flag  is  specified) the first sector of newly
       allocated partitions; it does not modify other contents of
       the  disk in any way.  However, it is used to redefine the
       allocation of the disk; deleting  a  partition  makes  the
       partition inaccessible and should be considered tantamount
       to erasing the partition.

       Flags


       -useAllSectors
             For compatibility with the  DOS  version,  fdisk  by
             default recognizes only those sectors that are bios-
             accessible.  However, if fdisk is passed  the  -use-
             AllSectors flag, it will recognize all sectors phys-
             ically present.  Data allocated in the extra sectors
             may  not  be  bios accessible, and certain fields in
             the partition  table  might  overflow,  which  might
             cause  problems  with  some operating systems.  Bios
             inaccessible sectors could prevent Darwin from boot-
             ing, though once booted Darwin is unaffected by bios
             limitations or partition table overflows.


       -useBoot0
             Reads in /usr/standalone/i386/boot0 to  be  used  as
             the  partition  boot program.  If this option is not
             specified, the existing boot program is retained.


       -bootsectorOnly
             Tells fdisk to modify only the bootsector when  sav-
             ing  changes.  Otherwise, the default behavior is to
             zero the first sector of newly-created partitions to
             ensure  that  extant  data  is not treated as a boot
             program or meaningful partition information.


       Interactive mode

       When fdisk is run in interactive  mode,  it  displays  the
       defined  partitions  and unallocated disk space, then dis-
       plays a menu.  Information on defined partitions includes:

       Type  The type of data the partition is said to contain.

       rt    The starting address of the partition, in megabytes.

       e     The size of the partition, in megabytes.

       tus   If the partition is marked as active, the  partition
             will  be booted from when the selected device is the
             boot device.


       All unused blocks on the disk  are  also  displayed,  with
       their sizes rounded to the nearest megabyte.

       Interactive mode main menu options


       a new partition
             Allocates  space  on  the  disk for use by Darwin or
             another operating system.  The  space  is  allocated
             from  the  first adequate free block.  The partition
             table structure only allows  for  4  partitions  per
             disk.


       +te partition
             Deallocates the space occupied by the specified par-
             tition.


        the active partition
             Specifies which partition is to be  booted  from  if
             the selected device is the boot device.


       w disk information
             Displays  the  layout of the disk, both according to
             the driver and according to the rom bios.  For  com-
             patibility  with  the  DOS version, fdisk by default
             only recognizes those sectors that are bios-accessi-
             ble.  However, if fdisk is passed the -useAllSectors
             flag, it will recognize all sectors physically  pre-
             sent.


       Non-interactive mode

       For  the  benefit  of  installation  scripts, fdisk can be
       given one inquiry or one action  to  effect  partitioning.
       Inquiries  do  not modify the partition table, but actions
       usually do.

       The following inquiries are allowed:


       -isDiskPartitioned
             Outputs "Yes" if the disk contains 1 or  more  valid
             partitions, "No" otherwise.


       -isThereExtendedPartition
             Outputs  "Yes"  if  the  disk  has  a  DOS  extended
             partition, "No" otherwise.


       -isThereUFSPartition
             Outputs "Yes" if the disk has a Apple UFS partition,
             "No" otherwise.


       -freeSpace
             Outputs  the size (in megabytes) of the largest free
             block on the disk.


       -freeWOUFS
             Outputs the size (in megabytes) of the largest  free
             block  on  the  disk if the Apple UFS partition were
             deleted.


       -freeWOUFSorExt
             Outputs the size (in megabytes) of the largest  free
             block on the disk if the Apple UFS and extended par-
             titions were deleted.


       -sizeofExtended
             Outputs the size (in megabytes) of the extended par-
             tition.


       -diskSize
             Outputs the size of the disk in megabytes.


       -installSize
             Outputs the size that Darwin would install to on the
             current disk; effectively the size of the Apple  UFS
             partition  if the disk is partitioned, otherwise the
             size of the disk.



       The following actions are allowed:


       -removePartitioning
             Zeros out the bootsector, eliminating the  partition
             table  and  boot program.  Prepares the disk so that
             Darwin will install on the entire disk.


       -bootPlusUFS
             Partitions the disk with 8  megs  reserved  for  the
             booter  (partition type 0xAB) and the remainder used
             for Darwin.  The booter partition is set active.


       -dosPlusUFS <megsForDos>
             Partitions the disk with <megsForDos>  reserved  for
             DOS and the remainder used for Darwin.


       -setAvailableToUFS
             Deletes   the  current  Apple  UFS  partition,  then
             reserves the largest free space for Darwin;  doesn't
             destroy other partitions.


       -setExtAndAvailableToUFS
             Deletes  the  current  Apple UFS and extended parti-
             tions, then reserves the largest free space for Dar-
             win; doesn't destroy other partitions.


       -setExtendedToUFS
             Changes the current extended partition to Apple UFS.


       -setUFSActive
             Makes the Apple UFS partition  active,  but  doesn't
             affect the size of any partition.

SEE ALSO
       disk(8)

BUGS
       When  creating  a partition, fdisk's idea of a megabyte is
       sometimes different than  other  versions;  fdisk  is  not
       guaranteed  to  locate the partition where another version
       would.

       fdisk knows nothing about logical  partitions,  which  are
       sub-partitions of an extended partition.

       fdisk  does not tolerate inconsistent partitions; a parti-
       tion that overlaps another will not  be  included  in  the
       partition  table  when  it  is written out, and the cylin-
       der/head/sector bios values are derived from the  absolute
       sector numbers.  Upon writing, the partition table entries
       are ordered the same as the actual partitions.



                           Mar 30, 1998                  FDISK(8)