[Previous] [Contents] [Index] [Next]

fdisk

Create QNX disk partition


Note: You must be root to run this utility.

Syntax:

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

Options:

-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 that's built into the fdisk utility.
-f
Force the boot loader to be written on command, even if it isn't possible to save an existing old loader to a mounted filesystem. In noninteractive use with the loader command, this forces the loader to be written in cases where the command would otherwise be aborted. In interactive use, the user is queried about the operation if -f isn't specified, and the operation simply proceeds without saving the old loader if -f is specified.
-p
Pause before starting.
-z
Zero the partition table (interactive mode only).
drive
Disk drive to partition. This must name a block special file (e.g. /dev/fd1, /dev/hd0).
[cmd [args]]
An installation command, as described below.

Description:

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.


Note: You can run fdisk only if you're root or have 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.

On some platforms, fdisk supports an interactive mode.



WARNING: 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 that's 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 hard disk driver:

devb-eide &

You should then execute the fdisk command to partition your disk:

fdisk /dev/hd0 add

The QNX filesystem doesn't automatically relearn any partition table changes made by fdisk. You must either slay and restart the filesystem/driver (devb-*) or use mount -e /dev/hd0 to recognize the new partitions and update the contents of /dev.

Commands

The fdisk utility supports the following commands directly from the command line:

add [args]
Add a new partition entry of the size and type specified. If fdisk can't locate sufficient unallocated disk space to satisfy your request, it allocates the largest available portion of the disk (if any). Here are the arguments for add:
-b
Makes the added partition bootable.
-c start,end
The start and end cylinder for the partition to use.
-p percent
The percentage of the largest contiguous space the added partition should use, this option is ignored if the -c option is used. The default is 100%.
-s slot
The slot in the partition table to use. The default is the first open slot.
-t type
The type variable gives the type of partition to be added (0 - 255). The default is 77.
Use this type: For:
77, 78, or 79 QNX 4
7, 8, or 9 QNX 2.1
1, 4, 6, 11, or 12 DOS
boot [args]
Turn on the boot flag for the indicated partition. If another partition was already flagged as the primary boot partition, the flag is turned off for it. Here are the arguments for boot:
-s slot
Boot the partition in the selected slot.
-t type
Boot the partition of the selected type.
delete [args]
Delete the specified partitions. Here are the arguments for delete:
-a
Delete all partitions.
-s slot
Delete the partition in the selected slot.
-t type
Delete this type of partition.
info
Show the mount information for the raw drive.
loader
Write the QNX loader to the disk.
query [args]
Print the number of cylinders to standard output. Here are the arguments for query:
-f
Print the total number of free cylinders.
-s slot
Print the number of cylinders for the partition in the selected slot.
-T
Print the total number of cylinders.
-t type
Print the number of cylinders for the partition of the selected type.
show
Display the partition table.

Examples:

Create a QNX partition that 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 -t 77 -p 50

Exit status:

0
Success.
>0
An error occurred.

Caveats:

After changing any partition information, you must either slay and restart the filesystem/driver (devb-*) or use mount -e to make the filesystem reread the partition table.

See also:

dinit, dloader

Backing Up and Recovering Data in the Neutrino User's Guide


[Previous] [Contents] [Index] [Next]