Creating a new filesystem on your target

You can use QNX utilities to create a new filesystem on your target.

Generic instructions

The instructions below are generic instructions for creating a filesystem on a target system. The details will vary depending on the type of filesystem, and the board and media on which you are creating the filesystem (e.g., a DOS filesystem on an x86 board with a SATA hard drive), but the tasks you need to complete and their sequence are valid for all QNX supported boards.

To create a new filesystem on your target, connect to the target, and on the target:

  1. Load the appropriate device driver (e.g., devb-eide).
  2. Identify the relevant device.
  3. Use fdisk to initialize or edit the partition table to delete unwanted partitions, and add the partition you want to use for your new filesystem (see fdisk in the Utilities Reference).
  4. Use mkfilesystem_typefs (e.g., mkdosfs, mkqnx6fs) to create the filesystem in the appropriate partition.
  5. Use mount to mount the partition that has your new filesystem (see mount in the Utilities Reference).

You should now have a new filesystem mounted in the partition you created for it.

Example

As an example, we'll to create a filesystem on an MMC device on a (fictitious) DK Elsinore Ghost 8 board. We assume that you are already connected to your board with a terminal emulation program such as Qtalk, Hyperterminal or PuTTy (for more information, see the BSP User's Guide that accompanies the BSP for your board).

For this example, the generic instructions above become, connect to your target and:

  1. Load the appropriate driver.

    We'll assume that the default buildfile starts the device driver (devb-sdmmc-elsinore-g8) so nothing more needs to be done.

  2. Identify the relevant device.

    An ls command in the target board's /dev directory shows two devices: /dev/hd0 and /dev/hd1.

    Since the board has an SD card, you need to determine which device is the SD card, and which is the MMC device. One (admittedly inelegant method) is to shut down the board and reboot without, then with the SD card to see which which device corresponds to the SD card. The MMC device is, course, the other device.

    We'll assume that /dev/hd0 is the MMC device.

  3. Print the current partition table for the MMC device:

    fdisk /dev/hd0 show
  4. We'll assume that there is already a FAT32 partition in slot 1, which we want to remove:

    fdisk /dev/hd0 delete -s 1
  5. Create the new partition:

    fdisk /dev/hd0 add -t 177
  6. Refresh the partition list:

    mount -e /dev/hd0

    which shows the new partition:

    /dev/hd0t177
  7. Format the Power-Safe filesystem in the new partition (see mkqnx6fs in the Utilities Reference):

    mkqnx6fs /dev/hd0t177
  8. Mount the filesystem in the root directory:

    mount /dev/hd0t177 /
Note: You can use the chkqnx6fs utility to check your Power-Safe filesystem.

For more information about Power-Safe filesystems, see Power-Safe filesystem in the System Architecture guide, and fs-qnx6.so in the Utilities Reference.