[Previous] [Contents] [Next]


Create QNX disk partition (QNX)


fdisk [-fpz] [-B loader] drive [cmd]


-B loader
Use the 512-byte file named by loader as the primary bootstrap loader for the device when instructed to write a boot loader to the disk. The default is to install a loader which is built-in to the fdisk utility.
Force boot loader to be written on command, even if it is not possible to save an existing old loader to a mounted filesystem. In non-interactive use with the loader command, this will force the loader to be written in cases where the command would otherwise be aborted. In interactive use, the user will be queried about the operation if -f is not specified, and the operation will simply proceed without saving the old loader if -f is specified.
Pause before starting.
Set the partition table to zero (all entries cleared).
Disk drive to partition.
An optional installation command, which is one of:


add [-f slot] {QNX|type} {ALL|HALF|QUARTER|TENTH|size}
boot [QNX|QNX2|DOS|OS2|type|slot]
query [QNX|QNX2|DOS|OS2|FREE|TOTAL|type|slot]


is the partition specifier (e.g. t77), as in the following list:
type For
t77, t78, or t79 QNX 4
t7, t8, or t9 QNX 2.1
t1, t4, t5, or t6 DOS
is the size of the partition, in cylinders (e.g. 680) or megabytes (e.g. 72m).
is partition number 1, 2, 3, or 4.

Refer to the description for more details on partition specifiers.


The fdisk utility lets you partition a hard disk. The partition information matches that used by DOS. The information is kept on the first physical block on the disk.


The fdisk utility can be run only by root or users with read/write permissions for the block special file concerned.

If you want your disk to contain both QNX and DOS partitions, we recommend that you create the DOS partition first, using DOS commands.


You can boot only from OS images that are loaded from within the first 1024 cylinders of the disk. This means that while you may be able to initially install and boot from a partition which extends past the 1024th cylinder, it will someday fail when you go to update the boot image because the location of some of its blocks may change. When this happens you will have a system which is no longer bootable.

Avoid this problem by creating a separate partition to boot from that lies entirely within the first 1024 cylinders of the hard drive, and use a second partition to access the additional space on the drive. (The boot partition may be quite small -- just a few megabytes will suffice.)

To create a QNX partition for the first time, you must first start the Filesystem Manager and the hard disk driver. For example:

    Fsys &
    disktrap start

You should then execute the fdisk command:

    fdisk /dev/hd0

to partition your disk.

QNX doesn't automatically mount any partition. Once you've created the partition, you should mount the disk using this partition (see mount).

It's important to realize that fdisk only displays and updates the partition information on the disk. It doesn't directly affect your access to the drive (see mount).

The fdisk utility is a fullscreen, interactive program that's fairly self-explanatory. When you invoke fdisk, you'll see a screen similar to this one (assuming your disk is already partitioned):

Ignore Next Prev 1 2 3 4 Change Delete Boot Unboot Restore Loader Save Quit

          __OS__        Start    End     _______Number_____    Size    Boot
        name  type  Cylinder  Cylinder  Cylinders  Blocks
   1.  DOS    (  4)       0       159       160      39165      19 MB
   2.  QNX2.x (  7)     160       419       260      63700      31 MB
   3.  QNX    ( 77)     420       854       435     106575      52 MB   *
   4.  ------ (---)   -----     -----     -----    -------   -----
Choose one of the partitions, by:    typing the partition number OR 
moving the pointer with the UP/DOWN arrows; then, choose one of the 
actions on the top line of the screen.

                                    Drive :  /dev/hd0

Size  :   102 Mbytes                Config:       7 Heads
Loader:       QNX                                35 Sectors/cyl
                                                855 Cylinders
                                    Last cylinder is 854

You'll see the available commands displayed at the top of the screen. To select a command, either type its first letter or move the cursor to the command (with the arrow keys) and press Enter.

The commands are:

Command: Action:
Next Move the pointer to the next entry.
Prev Move the pointer to the previous entry.
1, 2, 3, or 4 Move the pointer to the indicated entry.
Change Change the selected partition.
Delete Delete the selected partition.
Boot Turn on the boot flag for the selected partition.
Unboot Turn off the boot flag for the selected partition.
Restore Restore the previous non-QNX bootstrap loader.
Loader Change the bootstrap loader to the QNX loader.
Save Save all changes and quit.
Quit Quit without saving changes.

If you're changing a partition entry, you'll be required to enter the partition type number and the start and end cylinders. The other information will be calculated for you by fdisk.

Note that partition types 78 and 79 (which will appear on the interactive display as partition names QNY, QNZ, respectively) are the suggested OS types to use for second and third QNX 4 partitions.

Command mode:

The fdisk utility can also be run as a non-interactive utility using command-line options. This is useful for designing a custom installation procedure.

The command-mode syntax is:

fdisk supports the following commands directly from the command-line:

add [-f slot] {QNX|type} {ALL|HALF|QUARTER|TENTH|size}
Add a new partition entry of the size and type specified. If fdisk cannot locate sufficient unallocated disk space to satisfy your request, it will allocate the largest available portion of the disk (if any).

Using the -f (force) option deletes any existing partition in the specified partition number of the partition table. All allocated blocks are freed for reuse before attempting to allocate the requested space. Also, add will normally use the first available partition number, but the -f option will force it to use slot, the specified number.

boot [QNX|QNX2|DOS|OS2|type|slot]
Turn on the boot flag for the indicated partition. If another partition was already flagged as the primary boot partition, the flag will be turned off for it.
Show the mount information for the raw drive.
Write the QNX loader to the disk.
Show the fdisk partition entries.
query [QNX|QNX2|DOS|OS2|FREE|TOTAL|type|slot]
Print the number of cylinders to standard output.
is the partition specifier (e.g. t77), as in the following list:
ttype For
t77, t78, or t79 QNX 4
t7, t8, or t9 QNX 2.1
t1, t4, t5, or t6 DOS
is the size of the partition, in cylinders (e.g. 680) or megabytes (e.g. 72m).
is partition number 1, 2, 3, or 4.


Interactively create or edit the partition table of /dev/hd0:

    fdisk /dev/hd0

Create a QNX partition which occupies half the disk, or the largest available space if there isn't a space big enough for a new partition that occupies half the disk:

    fdisk /dev/hd0 add qnx HALF


The drive specified on the command line must name a block special file.

When no cmd is specified on the command line, fdisk is an intensely interactive fullscreen program using the standard input and standard output. The standard error is used for diagnostic messages upon severe errors (in non-interactive mode) and for ASCII BEL characters in interactive mode used to notify the user that something invalid has been entered into a field.

Exit status:

An error occurred.


After changing any partition that is mounted, you must either umount and then re-mount the changed partition or simply reboot. If you don't take these steps, you could damage the filesystem on the new partition.

See also:

dinit, fdformat, Fsys, mount

[Previous] [Contents] [Next]