GNU Parted - ArchWiki

# GNU Parted

Related articles

- GParted
- Partitioning

GNU Parted is a program for creating and manipulating partition tables. GParted is a GUI frontend.

## Installation

Install parted from the official repositories.

## Usage

Parted has two modes: command line and interactive. Parted should always be started with:

    # parted device

where `device` is the hard disk device to edit (for example `/dev/sda`). If you omit the `device` argument, parted will attempt to guess which device you want.

### Command line mode

In command line mode, this is followed by one or more commands. For example:

    # parted /dev/sda mklabel gpt mkpart P1 ext3 1MiB 8MiB

Note: Options (like `--help`) can only be specified on the command line.

### Interactive mode

In interactive mode, commands are entered one at a time at a prompt, and modify the disk immediately. For example:

    (parted) mklabel gpt
    (parted) mkpart P1 ext3 1MiB 8MiB

Tip: Some abbreviations are allowed. For example, you can type `p` instead of `print`, and `u` instead of `units`.

If you do not give a parameter to a command, Parted will prompt you for it. For example:

    (parted) mklabel
    New disk label type? gpt

## Rounding

Since many partitioning systems have complicated constraints, Parted will usually do something slightly different to what you asked. (For example, create a partition starting at 10.352Mb, not 10.4Mb) If the calculated values differ too much, Parted will ask you for confirmation. If you know exactly what you want, or to see exactly what Parted is doing, it helps to specify partition endpoints in sectors (with the "s" suffix) and give the "unit s" command so that the partition endpoints are displayed in sectors.

As of parted-2.4, when you specify start and/or end values using IEC binary units like “MiB”, “GiB”, “TiB”, etc., parted treats those values as exact, and equivalent to the same number specified in bytes (i.e., with the “B” suffix), in that it provides no “helpful” range of sloppiness. Contrast that with a partition start request of “4GB”, which may actually resolve to some sector up to 500MB before or after that point. Thus, when creating a partition, you should prefer to specify units of bytes (“B”), sectors (“s”), or IEC binary units like “MiB”, but not “MB”, “GB”, etc.

## Warnings

Parted will always warn you before doing something that is potentially dangerous, unless the command is one of those that is inherently dangerous (viz., rm, mklabel and mkpart).

### Alignment

When creating a partition, parted might warn about improper partition alignment but does not hint about proper alignment. For example:

    (parted) mkpart primary fat16 0 32M
    Warning: The resulting partition is not properly aligned for best performance.
    Ignore/Cancel?

The warning means the partition start is not aligned. Enter "Ignore" to go ahead anyway, print the partition table in sectors to see where it starts, and remove/recreate the partition with the start sector rounded up to increasing powers of 2 until the warning stops. As one example, on a flash drive with 512B sectors, Parted wanted partitions to start on sectors that were a multiple of 2048, which is 1MB alignment.

## See also

- GNU parted - Parted User's Manual
- How to align partitions for best performance using parted

Categories:

- File systems
- System recovery