icon Top 9 categories map      RocketAware > man pages >


Tips: Browse or Search all pages for efficient awareness of more than 6000 of the most popular reusable and open source applications, functions, libraries, and FAQs.

The "RKT couplings" below include links to source code, updates, additional information, advice, FAQs, and overviews.


Search all pages


By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Integer, Floating point, Matrix, Statistics, Boolean, ...

Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


RocketLink!--> Man page versions: OpenBSD FreeBSD NetBSD Others

FDISK(8)                OpenBSD System Manager's Manual               FDISK(8)

     fdisk - DOS partition maintenance program

     fdisk [-ie] [-f mbrname] [-c cyls] [-h heads] [-s sects] device

     In order for the BIOS to boot the kernel, certain conventions must be ad-
     hered to.  Sector 0 of a bootable hard disk must contain boot code, a MBR
     partition table, and a magic number.  These MBR partitions (also known as
     BIOS partitions) can be used to break the disk up into several pieces.
     The BIOS loads sector 0 of the boot disk into memory, verifies the magic
     number, and begins executing the code at the first byte.  The normal DOS
     MBR boot code searches the MBR partition table for an `active' partition
     (indicated by a `*' in the fist column), and if one is found, the boot
     block from that partition is loaded and executed in place of the original
     (MBR) boot block.

     The following options are available:

     -i          Initialize the MBR sector.

     -e          Edit existing MBR sectors.

     -f mbrname  Specifies an alternate MBR template file.

     -c,h,s      Specify an alternate BIOS geometry for fdisk to use.

     The DOS fdisk program can be used to divide space on the disk into parti-
     tions and set one active.  This fdisk program serves a similar purpose to
     the DOS program.  When called with no special flags, it prints the MBR
     partition table of the specified device, ie.

         # fdisk fd0
         Disk: fd0       geometry: 80/2/18 [2880 sectors]
         Offset: 0       Signatures: 0xAA55,0x0
                  Starting        Ending
          #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
         *0: A6    0   0   1 -   79   1  18 [         0 -       2880] OpenBSD
          1: 00    0   0   0 -    0   0   0 [         0 -          0] unused
          2: A7    0   0   2 -   79   1  18 [         1 -       2879] NEXTSTEP
          3: 00    0   0   0 -    0   0   0 [         0 -          0] unused

     The geometry displayed is the BIOS geometry unless another geometry has
     been selected using the -c, -h, and -s options.

     This disk is divided into two partitions that happen to fill the disk.
     The first partition overlaps the third partition.  (Used for debugging

     #           Number of partition table entry.  A '*' denotes the bootable

     id          System identifier.  OpenBSD reserves the magic number 166
                 decimal (A6 in hex).  If no 166 partition is found, it will
                 use an older FreeBSD partition (with a magic number of 165 or
                 A5 in hex).

     cyl/hd/sec  These fields provide the starting and ending address of the
                 partition in BIOS geometry

     start/size  These fields provide the starting sector and size in sectors
                 of the partition in linear block addresses.

     NOTE: Note that the sectors field is `1 based', and the start field is `0
     based'.  The CHS values will need to be in the BIOS's geometry for the
     system to be able to boot and use the drive correctly.

     The -i flag is used to indicate that the partition data is to be initial-
     ized.  In this mode, fdisk will completely overwrite the primary MBR, and
     start with a fresh one using a default template, or one given by the -f
     flag.  It will set up partition number 3 to be an OpenBSD partition, that
     will start at cylinder 0, head 1, sector 1, and extend to the end of the
     disk.  This mode is designed to initialize an MBR the very first time, or
     when it has been corrupted beyond repair.  It is almost equivelant to the
     DOS command `FDISK /MBR'.

     The flag -e is used to modify a partition table using a interactive edit
     mode of the fdisk program.  This mode is designed to allow you to change
     any partition on the drive you choose, including extended partitions.  It
     is a very powerfull mode, but is safe as long as you do not execute the
     write command, or answer in the negative (the default) when fdisk askes
     you about writing out changes.

     When you first enter this mode, you are presented with a prompt, that
     looks like so: fdisk: 0>. This prompt has two important pieces of infor-
     mation for you.  It will tell you if the in memory copy of the boot block
     has been modified or not.  If it has been modified, the prompt will
     change to look like: fdisk:*0>. The second piece of information pertains
     to the number given in the prompt.  This number specifies the disk offset
     of the currently selected boot block you are editing.  This number could
     be something different that zero when you are editing extended parti-
     tions.  The list of commands and their explanations are given below.

     help    This command gives you a list of commands that fdisk understands
             in the interactive edit mode.

     reinit  This command initializes the currently selected, in memory copy,
             of the boot block.

     disk    This command will display the current drive geometry that fdisk
             has probed.  You are given a chance to edit them if you wish.

     edit    This command is used to edit a given table entry in the memory
             copy of the current boot block.  You may edit either in BIOS ge-
             ometry mode, or in sector offsets and sizes.

     flag    This command makes the given partition table entry bootable.  On-
             ly one entry can be marked bootable. If you wish to boot from an
             extended partition, you will need to mark the partition table en-
             try for the extended partition as bootable.

     update  This command will update the machine code in the memory copy of
             the currently selected boot block.

     select  This command will select and load into memory the boot block
             pointed to by the extended partition table entry in the current
             boot block.

     print   This command will print the currently selected in memory copy of
             the boot block and its MBR table to the terminal.

     write   This will write the in memory copy of the boot block to disk.
             You will be asked to confirm this operation.

     exit    This will exit the current level of fdisk, either returning to
             the previously selected in memory copy of a boot block, or exit

             the program if there is none.

     quit    This will exit the current level of fdisk, either returning to
             the previously selected in memory copy of a boot block, or exit
             the program if there is none.  Unlike exit it does write the mod-
             ified block out.

     abort   Quit program without saving current changes.

     The automatic calculation of starting cylinder etc. uses a set of figures
     that represent what the BIOS thinks is the geometry of the drive.  These
     figures are by default taken from the incore disklabel, or values that
     /boot has passed to the kernel, but fdisk gives you an opportunity to
     change them if there is a need to.  This allows the user to create a
     bootblock that can work with drives that use geometry translation under a
     potentially different BIOS.

     If you hand craft your disk layout, please make sure that the
     OpenBSD partition starts on a cylinder boundary.  (This restriction may
     be changed in the future.)

     Editing an existing partition is risky, and may cause you to lose all the
     data in that partition.

     You should run this program interactively once or twice to see how it
     works.  This is completely safe as long as you answer the write questions
     in the negative.

     /usr/mdec/mbr - the default MBR template

     disklabel(8),  boot_i386(8)

     There are subtleties that the program detects that are not explained in
     this manual page.  Also, chances are that some of the subleties it should
     detect are being steamrolled.  Caveat Emperor.

OpenBSD                          April 4, 1993                               3

Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY
SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts
Institute of Technology, Free Software Foundation, FreeBSD Inc., and others.

(Corrections, notes, and links courtesy of RocketAware.com)

[Detailed Topics]
FreeBSD Sources for fdisk(8)
OpenBSD sources for fdisk(8)

[Overview Topics]

Up to: File System Operations - Operations for entire file-systems (quotas, configuration, consistency, mount, unmount, et al)

RocketLink!--> Man page versions: OpenBSD FreeBSD NetBSD Others

Rapid-Links: Search | About | Comments | Submit Path: RocketAware > man pages > fdisk.8/
RocketAware.com is a service of Mib Software
Copyright 1999, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments