How To Install parted on Ubuntu 22.04

In this tutorial we learn how to install parted on Ubuntu 22.04. parted is disk partition manipulator

Introduction

In this tutorial we learn how to install parted on Ubuntu 22.04.

What is parted

parted is:

GNU Parted is a program that allows you to create, destroy, resize, move, and copy disk partitions. This is useful for creating space for new operating systems, reorganizing disk usage, and copying data to new hard disks.

This package contains the binary and manual page. Further documentation is available in parted-doc.

Parted currently supports DOS, Mac, Sun, BSD, GPT, MIPS, and PC98 partitioning formats, as well as a “loop” (raw disk) type which allows use on RAID/LVM. It can detect and remove ASFS/AFFS/APFS, Btrfs, ext2/3/4, FAT16/32, HFS, JFS, linux-swap, UFS, XFS, and ZFS file systems. Parted also has the ability to create and modify file systems of some of these types, but using it to perform file system operations is now deprecated.

The nature of this software means that any bugs could cause massive data loss. While there are no such bugs known at the moment, they could exist, so please back up all important files before running it, and do so at your own risk.

There are three methods to install parted on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install parted Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install parted using apt-get by running the following command:

sudo apt-get -y install parted

Install parted Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install parted using apt by running the following command:

sudo apt -y install parted

Install parted Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install parted using aptitude by running the following command:

sudo aptitude -y install parted

How To Uninstall parted on Ubuntu 22.04

To uninstall only the parted package we can use the following command:

sudo apt-get remove parted

Uninstall parted And Its Dependencies

To uninstall parted and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove parted

Remove parted Configurations and Data

To remove parted configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge parted

Remove parted configuration, data, and all of its dependencies

We can use the following command to remove parted configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge parted

References

Summary

In this tutorial we learn how to install parted package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.