dinit

disk initialization (QNX)

Syntax:

dinit [-bhpqr] [-B filename|-O] [-L label|-l label]
      [-m message] drive

Options:

-b
Write only the OS loader to disk.
-B filename
Use 512 byte OS loader from this file rather than the standard QNX OS loader. Note that on a partitioned hard disk, the OS loader is the second loader, not the primary bootstrap loader which is written to the first block of the hard disk by the fdisk utility. On a non-partitioned device (e.g. floppy) the OS loader will be the primary (and only) bootstrap loader.
-h
Initialize the hard disk. You can't initialize a hard disk unless you specify this option.
-l label
("el") Write volume label to disk after initializing.
-L label
Write only the volume label to disk.
-m message
Replace the message the OS displays when booting from disk with message.
-O
Use the old QNX bootstrap loader. The old loader loads at (real mode) 0x60:0, always. The newer loader looks for a signature byte in the beginning of the OS image to determine if it is old or new, and loads at 60h:00 or 80h:00 as appropriate. The start address for new images is 0h relative to the load address, while the start address for old images is 20h relative to the load address.
-p
Pause for a keystroke before continuing.
-q
Be quiet; don't echo or question.
-r
Write only the root block to disk.
drive
Drive on which the hard disk or diskette is to be initialized (e.g. /dev/fd0, /dev/hd0t77, etc.).

Examples:

Initialize a hard disk:

    dinit -h /dev/hd0t77

Initialize a floppy disk:

    dinit /dev/fd0

Pause before initializing hard disk:

    dinit -hp /dev/hd0t77

Initialize floppy disk on node 3:

    dinit //3/dev/fd0

Description:

The dinit utility initializes a formatted diskette or hard disk so that it may be used as a QNX filesystem. The default values are determined from the current configuration of the specified drive.

If the disk is a hard disk, you need to specify the -h (hard) option. This option helps protect you against typing errors that might cause dinit to initialize your hard disk. To initialize a hard disk, you must be the superuser.

Once you initialize a hard disk with dinit, you should use the dcheck utility to remove any bad blocks from the disk allocation bitmap. For example:

    dinit -h /dev/hd0t77
    dcheck -m /dev/hd0t77

To initialize a disk on another node, you must explicitly indicate the disk via a //node prefix.

A disk may be labeled with a user's specified label of up to 48 characters. You specify the label using the -l ("el") option. For example:

    dinit -l "Transfer floppy" /dev/fd0

If you want to label a disk that has already been initialized with dinit, but you don't want to re-initialize it, you may use the -L option.

Labels are most useful on removable media (hard disk cartridges or floppy disks) for verifying that you have the correct disk in the drive. If the disk is already labeled, you won't be allowed to re-initialize the disk without specifying a matching label or first removing the label. The label may be removed by using -L with an empty string as follows:

    dinit -L "" /dev/fd0

The fdformat utility will also check for already labeled diskettes in the same manner, preventing accidental reformatting of your floppies.

When dinit initializes a disk, it writes a loader in the first block. If the disk is a floppy diskette, the loader is the bootstrap loader, else it is the secondary (or partition) loader. If you feel the need to rewrite the loader without re-initializing the disk, you may specify the -b option.

The -m option lets you change the message the OS displays when booting from disk. Normally, the message is:

    Press ESC to boot alternate OS.

Your new message must include a trailing period. The OS will display the specified text up to the first period encountered. For example, if message is "Booting ...", the printed message will be:

     Booting .

Your new message may contain up to 30 characters plus the trailing period. You can specify the minimum message of "." by entering:

    -m.

Exit status:

0
Successful.
>0
An error occurred.

Files:

All files are lost on the specified disk.

See also:

Caveats:

Don't use the -r option unless you know exactly what you're doing. You use the -r option only after a disaster has destroyed the first few blocks of your disk (e.g. a power failure occurred while the disk was being updated). In order for any damage to be repaired, you must follow dinit -r with this command:

    chkfsys drive