Forrest logo
back to the partx tool

partx:tldr:91ec3

partx: Delete all the partitions found from the kernel (does not alter partitions on disk).
$ sudo partx --delete ${path-to-device_or_disk_image}
try on your machine

The sudo partx --delete ${path-to-device_or_disk_image} command is used to delete the partition table entries of a specified device or disk image. Here's a breakdown of the command:

  • sudo: The sudo command allows you to execute the following command with administrative privileges. It is used when you need superuser permissions to perform a certain task.

  • partx: The partx command is a Linux utility that enables you to manipulate the partition table on a device. It can list, add, delete, or update partition table entries.

  • --delete: This option is used with the partx command to delete partition table entries. When used, it deletes the partition table entries of the specified device or disk image.

  • ${path-to-device_or_disk_image}: This placeholder should be replaced with the actual path to the device or disk image you want to manipulate. It can be the path to a block device like /dev/sda or the path to a disk image file like /path/to/disk.img.

By running this command with administrative privileges (sudo), partx will remove the partition table entries of the specified device or disk image, essentially deleting the existing partition information.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the partx tool