gpart command not found

In this troubleshooting guide we learn how to fix gpart command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

gpart: command not found

or when using sudo you get the following error message

sudo: gpart: command not found

Solutions to gpart: command not found

How To Fix gpart: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu gpart is provided by gpart package.

gpart is:

Gpart is a tool which tries to guess the primary partition table of a PC-type disk in case the primary partition table in sector 0 is damaged, incorrect or deleted.

It is also good at finding and listing the types, locations, and sizes of inadvertently-deleted partitions, both primary and logical. It gives you the information you need to manually re-create them (using fdisk, cfdisk, sfdisk, etc.).

The guessed table can also be written to a file or (if you firmly believe the guessed table is entirely correct) directly to a disk device.

Currently supported (guessable) filesystem or partition types:

  • BeOS filesystem type.
  • BtrFS filesystem type.
  • FreeBSD/NetBSD/386BSD disklabel sub-partitioning scheme used on Intel platforms.
  • Linux second extended filesystem (Ext2).
  • MS-DOS FAT12, FAT16 and FAT32 “filesystems”.
  • IBM OS/2 High Performance filesystem.
  • Linux LVM and LVM2 physical volumes.
  • Linux swap partitions (versions 0 and 1).
  • The Minix operating system filesystem type.
  • MS Windows NT/2000 filesystem.
  • QNX 4.x filesystem.
  • The Reiser filesystem (version 3.5.X, X > 11).
  • Sun Solaris on Intel platforms uses a sub-partitioning scheme on PC hard disks similar to the BSD disklabels.
  • Silicon Graphics journaled filesystem for Linux.

Gpart is useful in recovery actions and forensics investigations.

To fix this problem, we can install more using the command below.

sudo apt-get -y install gpart

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install gpart.

sudo apt -y install gpart

Or if you have aptitude installed you can use the following command.

sudo aptitude install gpart

Summary

In this tutorial we learn how to fix gpart command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.