pted

QNX SDP8.0Utilities ReferenceUtilities

Partition table editor

Syntax:

pted [-a num] device cmd ...

Runs on:

QNX OS

Options:

-a num
Align partitions to multiples of num blocks. The default alignment is 8 blocks. This alignment isn't stored anywhere, so if you used another value when initializing a disk, you must specify it again with every subsequent run of pted.
device
The block device to operate on (e.g., /dev/hd0).
cmd
One of the commands below, or a unique prefix thereof:
  • add — add a new partition
  • delete — remove an existing partition
  • edit — modify an existing partition
  • loader — write a primary MBR boot loader
  • initialize — set up a new, empty partition table
  • patch — patch the offsets of Power-Safe (fs-qnx6.so) partitions
  • show — display the existing partitions
  • uniquify — assign new random GUIDs to disk and partitions

For more details, see below.

Description:

The pted utility is a partition table editor that runs on a QNX OS target and operates on disks (e.g., /dev/hd0). It understands both MBR and GPT disk partitioning schemes. The pted editor has some similarities to diskimage, and fdisk, but:

  • You use diskimage on a development host to create a file (on the host filesystem) that contains the binary image of a MBR- or GPT-partitioned disk, typically with partitions formatted as a Power-Safe (fs-qnx6.so) filesystem, and populated with directories and files. You transfer this file to a QNX OS target, and then write it onto a matching disk.
  • You use fdisk on a QNX OS target, but it supports only MBR partitions.

The commands include:

add -t type | -T guid [-s blocks | -p percent] [option...]
Add a GPT partition. All available space is used, unless you specify the -p or -s option. The options include:
  • -# slotnr — use slot number slotnr. Slot numbers start at 1; the default is the first available.
  • -b — set the biosboot attribute
  • -n name — set the partition name to name. By default, pted generates a unique name from the partition type.
  • -p pct — use pct percent of space. Positive values denote a percentage of the total data blocks on the disk; negative values indicate a percentage of the largest available gap.
  • -s size — use size blocks for the new partition
  • -t type — a partition type alias (e.g., qnx6)
  • -T guid — a partition type GUID. For information on types, see the entry for the diskimage configuration file.
add -t type [-s blocks | -p pct] [option...]
Add an MBR partition. All available space is used, unless you specify the -p or -s option. The options include:
  • -# slotnr — use slot number slotnr. Slot numbers start at 1; the default is the first available.
  • -b — make the partition bootable
  • -p pct — use pct percent of space. Positive values denote a percentage of the total data blocks on the disk; negative values indicate a percentage of the largest available gap.
  • -s size — use size blocks for the new partition
  • -t type — the partition type (e.g., 177, 178, 179)
Note: You can't use pted to create the following partition types:
  • Type 5 designates an extended partition (used to describe logical partitions).
  • Type 238 is reserved by UEFI for GPT disks. In the protective MBR of a GPT disk, the entire remaining disk (governed by GPT) is described as one large GPT partition.

Without setting up further metadata, adding these partition types could damage the disk contents or cause failures in general disk recognition.

delete -# slotnr
Remove an existing partition. The options include:
  • -# slotnr — delete slot number slotnr
edit -# slotnr [options]
Modify an existing GPT partition. The options include:
  • -# slotnr — edit the partition at slot number slotnr
  • -B — unset the biosboot attribute
  • -b — set the biosboot attribute
  • -n name — set the partition name to name
  • -t type — set partition type by alias (e.g., qnx6)
  • -T guid — set partition type by GUID
edit -# slotnr [options]
Modify an existing MBR partition. The options include:
  • -# slotnr — edit the partition at slot number slotnr
  • -B — make the partition nonbootable
  • -b — make the partition bootable
  • -t type — set the partition type (e.g., 177, 178, 179)
initialize [-g | -G num]
Set up a new, empty partition table. The options include:
  • -g — initialize a GPT disk with the default number of 128 entries
  • -G num — initialize a GPT disk with num partition table entries. You must specify a non-negative number that's no more than 1024.

The default is to initialize an MBR disk.

loader -f path
Write a primary MBR boot loader. The options include:
  • -f path — store the contents of path in the MBR boot loader section
patch [-# slotnr] [-f]
Patch the offsets of Power-Safe partitions. The options include:
  • -# slotnr — patch only slot number slotnr (default: all)
  • -f — force; patch any type of partition (default: Power-Safe only)
show [-# slotnr] [-h[h]] [-v...]
Display the existing partitions. The options include:
  • -# slotnr — show only slot number slotnr
  • -h — show headers (-hh: show headers only)
  • -v — increase verbosity
uniquify
Make unique; assign new random GUIDs to disk and partitions. No options are currently defined.

Examples:

To initialize a GPT disk on a QNX OS target:

  1. Begin with an empty disk:
    # ls /dev/hd1*
    /dev/hd1
  2. Initialize the GPT partition tables:
    # pted /dev/hd1 init -g
  3. Add a FAT (Microsoft) partition:
    # pted /dev/hd1 add -tms -nFAT -s16384
  4. Inspect / reload the partition tables:
    # pted /dev/hd1 show -vv
         Partition   1: 
            Attributes: 
                  Type: Microsoft File System
             Type GUID: EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
           Unique GUID: 85013C9C-5214-45E5-91F6-691F70C521A0
          Starting LBA: 40
            Ending LBA: 16423
               Sectors: 16384
                  Name: FAT
    # mount -e /dev/hd1
    # ls /dev/hd1*
    /dev/hd1         /dev/hd1.ms.0
  5. Initialize the FAT filesystem:
    # mkdosfs /dev/hd1.ms.0 
    Format complete: FAT12 (4096-byte clusters), 8168 kB available.
Page updated: