LinuxCommandLibrary

partprobe

Update kernel's partition table without rebooting

TLDR

Notify the operating system kernel of partition table changes

$ sudo partprobe
copy

Notify the kernel of partition table changes and show a summary of devices and their partitions
$ sudo partprobe [[-s|--summary]]
copy

Show a summary of devices and their partitions but don't notify the kernel
$ sudo partprobe [[-s|--summary]] [[-d|--dry-run]]
copy

SYNOPSIS

partprobe [options] [DEVICE...]

PARAMETERS

DEVICE...
    Specifies one or more block devices (e.g., /dev/sda, /dev/nvme0n1) for which the kernel should re-read the partition table. If no devices are specified, partprobe attempts to re-read the partition tables for all known block devices.

-d, --dry-run
    Performs a dry run. It shows what partprobe would do without actually informing the kernel of any changes. This is useful for testing or debugging.

-s, --script
    Suppresses all output from partprobe. This option is particularly useful when integrating partprobe into automated scripts where verbose output is not desired.

-h, --help
    Displays a concise help message detailing the command's usage and available options, then exits.

-v, --version
    Prints the version information of the partprobe utility and then exits.

DESCRIPTION

The partprobe command is a crucial utility used in Linux to inform the operating system kernel about changes made to partition tables on block devices. When you modify a disk's partition structure using tools like fdisk, sfdisk, or gparted, the kernel often caches the old partition layout.

Without notifying the kernel, the system might continue to see the old partitions or fail to recognize new ones, even though the changes have been written to the disk. partprobe addresses this by instructing the kernel to re-read the partition table for specified devices, or for all devices if none are specified. This allows the system to recognize new or modified partitions without requiring a reboot, which is essential for dynamic storage management and scripting.

CAVEATS

In-use Partitions: partprobe cannot successfully re-read a partition table on a device if any partition on that device is currently in use (e.g., mounted, open for swap, or actively accessed by a process). You might need to unmount partitions or stop services before running partprobe.

Root Privileges: This command requires superuser (root) privileges to execute, as it interacts directly with the kernel's block device subsystem.

No Modification: partprobe does not create, delete, or modify partitions on a disk. It only informs the kernel about partition table changes that have already been written to the disk by other partitioning tools.

Complex Setups: For more complex storage configurations like Logical Volume Management (LVM), software RAID, or multipath devices, partprobe alone might not be sufficient. Other dedicated tools (e.g., pvscan, vgscan, mdadm) may be required to update the kernel's view of these structures.

PERMISSIONS

Executing partprobe requires elevated privileges, typically root, because it needs to interact directly with the kernel to modify its understanding of block devices and their partition layouts. Without sufficient permissions, the command will fail.

WHEN TO USE

Use partprobe immediately after using a partitioning tool (like fdisk, gparted, sgdisk) to write new partition changes to disk. It ensures the kernel is aware of the new layout before attempting to create file systems (mkfs) or mount the new partitions.

HISTORY

partprobe is an integral part of the util-linux project, a widely used collection of essential Linux system utilities. Its development became critical as Linux systems evolved towards more dynamic and hot-pluggable storage management, reducing the need for system reboots after disk partitioning changes.

SEE ALSO

fdisk(8), sfdisk(8), gparted(8), kpartx(8), mount(8), losetup(8), lsblk(8)

Copied to clipboard