How to use the command partprobe (with examples)

How to use the command partprobe (with examples)

Partprobe is a command that allows the user to notify the operating system kernel of partition table changes. It is useful in scenarios where the user has made changes to the partition table and wants the kernel to recognize those changes without having to reboot the system.

Use case 1: Notify the operating system kernel of partition table changes

Code:

sudo partprobe

Motivation: The motivation behind using this example is to notify the operating system kernel of any changes made to the partition table. This is especially useful when you have created, deleted, or modified partitions on a disk and want the kernel to recognize those changes without rebooting the system.

Explanation:

  • sudo: This command is used to execute the partprobe command with superuser privileges, granting the necessary permissions to notify the kernel about the partition table changes.
  • partprobe: This is the command itself, which notifies the operating system kernel of the changes made to the partition table.

Example output:

# sudo partprobe

Use case 2: Notify the kernel of partition table changes and show a summary of devices and their partitions

Code:

sudo partprobe --summary

Motivation: This use case is helpful when you want to not only notify the kernel about the changes in the partition table but also view a summary of the devices and their partitions. This allows you to verify and confirm the changes that have been made.

Explanation:

  • sudo: Similar to the previous example, this command is used to execute the partprobe command with superuser privileges.
  • partprobe: The command itself that notifies the operating system kernel of the changes made to the partition table.
  • --summary: This option tells partprobe to display a summary of devices and their partitions after notifying the kernel.

Example output:

# sudo partprobe --summary
/dev/sda: msdos partitions 1 2 3

Use case 3: Show a summary of devices and their partitions but don’t notify the kernel

Code:

sudo partprobe --summary --dry-run

Motivation: The motivation behind using this example is to view a summary of devices and their partitions without actually notifying the kernel. This is useful when you only want to verify the existing partition table without making any changes or updates to the kernel.

Explanation:

  • sudo: As mentioned before, this command is used to execute the partprobe command with superuser privileges.
  • partprobe: The command itself that notifies the operating system kernel of the changes made to the partition table.
  • --summary: This option tells partprobe to display a summary of devices and their partitions.
  • --dry-run: This option simulates the execution of the command without actually modifying the partition table or notifying the kernel.

Example output:

# sudo partprobe --summary --dry-run
/dev/sda: msdos partitions 1 2 3

Conclusion:

In conclusion, the partprobe command is a useful tool for notifying the operating system kernel of changes made to the partition table. By using various options such as –summary and –dry-run, users can also view a summary of devices and their partitions without actually modifying the partition table or notifying the kernel. The command is particularly handy when you want to make changes to the partition table without having to reboot the system.

Related Posts

How to use the command 'rpmspec' (with examples)

How to use the command 'rpmspec' (with examples)

The ‘rpmspec’ command is used to query or parse a RPM spec file.

Read More
How to use the command dotnet tool (with examples)

How to use the command dotnet tool (with examples)

The dotnet tool command allows users to manage .NET tools and search for published tools in NuGet.

Read More
How to use the command macchina (with examples)

How to use the command macchina (with examples)

The ‘macchina’ command is a powerful tool that allows you to display information about your computer.

Read More