Forrest logo
back to the parted tool

parted:tldr:40b46

parted: Create a new partition table of the specified label-type.
$ sudo parted --script ${-dev-sdX} mklabel ${select}
try on your machine

This command is used in the Linux terminal to create a partition table with a specific label on a storage drive.

Let's break down the command step by step:

  • sudo: This is used to run the command with root or administrative privileges. It allows the user to perform actions that require higher permissions.

  • parted: It is a command-line utility in Linux used for partitioning disks. It allows users to create, resize, and modify disk partitions.

  • --script: This option allows the command to run in non-interactive mode, meaning it will not prompt for user confirmation. It is useful when automating partitioning tasks.

  • ${-dev-sdX}: This is a placeholder for the name of the storage device you want to partition. It should be replaced with the actual device name, such as /dev/sda or /dev/nvme0n1. The device name represents the physical drive you want to work on.

  • mklabel: This subcommand is used to create a new partition table on the specified storage device. It initializes the disk and prepares it for partitioning.

  • ${select}: This is a placeholder for the type of partition table you want to create. It should be replaced with the desired label, such as gpt (GUID Partition Table) or msdos (Master Boot Record). The label determines the format and structure of the partition table.

Overall, this command allows you to create a partition table with the specified label on a storage device using administrative privileges, without requiring user interaction.

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 parted tool