Disks and file system

Command parted

Manage disk partitions

Linux · Bash examples · commands run on the selected server

When to use parted

Use parted's print operations to inspect disk labels, partitions and unallocated regions. Keep inspection distinct from partition editing: changes can affect live data and may be applied immediately.

Syntax

parted [OPTIONS] [DEVICE [COMMAND]]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-l
Display disk layout.
unit UNIT
Select units, for example MiB.
print
Show the current partition table.

Usage examples

View list of disks

sudo parted -l

Detected disks and partition tables are listed.

View the layout of one disk

sudo parted /dev/vdb print

One disk's current table is printed without requesting a change.

View free areas

sudo parted /dev/vdb unit MiB print free

Free regions are included and sizes are displayed in mebibytes.

Notes and limitations

  • Layout modification commands can be applied immediately. The examples here are limited to viewing.
  • Before any changes, a backup is required; the /dev/vdb path in the example does not identify your drive.

Common questions and troubleshooting

Does print free allocate unused disk space?

No. It reports the layout. Allocation requires separate operations and may also require filesystem resizing afterward.

Why are disk size and free filesystem space different?

Partition layout, filesystem capacity and filesystem free space are separate layers. Inspect each before choosing a resize operation.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man parted.