commands

parted — Inspect or edit partition tables

Display a private image partition table; an unrecognized label may indicate an uninitialized image, not absence of data. Editing commands can write immediately. Use a fresh private workspace; live operations are VM-only.

Formal Syntax & Structure

linux syntaxlinux
parted IMAGE print

Parameters & Attributes

NameTypeDescription
IMAGEoperandPrivate regular image
printoperandShow table

Return Value

exit status and output

The print operation displays the image's recognized partition table; an unrecognized label can produce an error even for a newly created blank image. It is not proof of unused storage.

Working Example

Example Snippetlinux
test ! -e ./disk.img && test ! -L ./disk.img || exit 1(set -o noclobber; : > ./disk.img) || exit 1truncate -s 33554432 ./disk.img || exit 1test -f ./disk.img && test ! -L ./disk.img || exit 1parted ./disk.img print
Linux Reference