parted: command not found

The GNU parted utility is also used to view the existing partition table, change the size of existing partitions, or add partitions from free space or additional hard drives. This utility is more advanced than the fdisk utility. It supports more disk label types and offers additional commands. parted syntax is:

# parted [option] [device_name] [command [argument]]

Use parted interactively to enter commands one at a time. Include only the device as an argument to invoke interactive mode. Example:

# parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)

From the (parted) prompt, enter a command or type help to view the list of available commands. Get additional help on a specific command by typing help plus the command. Example:

If you encounter below error while running the parted command:

parted: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install parted
Ubuntu apt-get install parted
Alpine apk add parted
Arch Linux pacman -S parted
Kali Linux apt-get install parted
CentOS yum install parted
Fedora dnf install parted
Raspbian apt-get install parted

parted Command Examples

1. List partitions on all block devices:

# parted --list

2. Start interactive mode with the specified disk selected:

# parted /dev/sdX

3. Create a new partition table of the specified label-type:

# parted --script /dev/sdX mklabel aix|amiga|bsd|dvh|gpt|loop|mac|msdos|pc98|sun

4. Show partition information in interactive mode:

print

5. Select a disk in interactive mode:

select /dev/sdX

6. Create a 16 GB partition with the specified filesystem in interactive mode:

mkpart primary|logical|extended btrfs|ext2|ext3|ext4|fat16|fat32|hfs|hfs+|linux-swap|ntfs|reiserfs|udf|xfs 0% 16G

7. Resize a partition in interactive mode:

resizepart /dev/sdXN end_position_of_partition

8. Remove a partition in interactive mode:

rm /dev/sdXN
Related Post