You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Complete guide to partprobe - Inform OS of Partition Table Changes
category
Storage
tags
storage
disk management
lvm
partitioning
systemd
difficulty
beginner
last_updated
2026-06-06
related_commands
blockdev
partx
kpartx
fdisk
sgdisk
partprobe - Inform OS of Partition Table Changes
Overview
partprobe is a utility that informs the operating system kernel of partition table changes. After modifying disk partitions using tools like fdisk, gdisk, or parted, partprobe ensures the kernel re-reads the partition table without requiring a system reboot. This is essential for making new partitions immediately available for formatting and mounting.
Installation
Package Managers
# Debian/Ubuntu (part of parted)
apt-get install parted
# RHEL/CentOS/Fedora
dnf install parted
# Arch Linux
pacman -S parted
# Alpine Linux
apk add parted
Basic Syntax
partprobe [OPTIONS] [DEVICE...]
Core Operations
Basic Usage
# Probe all block devices
partprobe
# Probe specific device
partprobe /dev/sda
# Probe multiple devices
partprobe /dev/sda /dev/sdb /dev/sdc
# Dry run (show what would be done)
partprobe --dry-run /dev/sda
partprobe -d /dev/sda
# Summary mode (show partition changes)
partprobe --summary /dev/sda
partprobe -s /dev/sda
Common Use Cases
After Partition Creation
# Create partition with fdiskecho -e "n\np\n1\n\n\nw"| fdisk /dev/sdb
# Inform kernel of new partition
partprobe /dev/sdb
# Verify partition is visible
lsblk /dev/sdb
ls -l /dev/sdb1
# Format new partition
mkfs.ext4 /dev/sdb1
After Partition Deletion
# Delete partitionecho -e "d\n1\nw"| fdisk /dev/sdb
# Update kernel partition table
partprobe /dev/sdb
# Verify partition is gone
lsblk /dev/sdb
ls -l /dev/sdb1 # Should fail
After Partition Resize
# Resize partition (example with parted)
parted /dev/sdb resizepart 1 100GB
# Inform kernel of change
partprobe /dev/sdb
# Resize filesystem to match
resize2fs /dev/sdb1 # For ext4
xfs_growfs /mount/point # For XFS
#!/bin/bash
DEVICE=$1# Check if device is mountedif mount | grep -q "$DEVICE";thenecho"Error: Device has mounted partitions"
mount | grep "$DEVICE"exit 1
fi# Check if device is in useif lsof "$DEVICE"2>/dev/null;thenecho"Error: Device is in use"
lsof "$DEVICE"exit 1
fi# Safe to partition# ... partition operations ...# Reload partition table
partprobe "$DEVICE"# Verifyif partprobe --dry-run --summary "$DEVICE"2>&1| grep -q "partitions";thenecho"Partition table updated successfully"elseecho"Warning: Partition table may not have updated"fi
Integration with System Services
Systemd Service
# Create service to probe on boot
cat > /etc/systemd/system/partprobe-boot.service << 'EOF'[Unit]Description=Probe partition tables on bootDefaultDependencies=noAfter=local-fs-pre.targetBefore=local-fs.target[Service]Type=oneshotExecStart=/usr/sbin/partprobeRemainAfterExit=yes[Install]WantedBy=local-fs.targetEOF
systemctl daemon-reload
systemctl enable partprobe-boot.service
Udev Rules
# Auto-probe when disk added
cat > /etc/udev/rules.d/99-partprobe.rules << 'EOF'SUBSYSTEM=="block", KERNEL=="sd[a-z]", ACTION=="add", \ RUN+="/usr/sbin/partprobe $env{DEVNAME}"EOF# Reload udev rules
udevadm control --reload-rules
# partprobe can take time on large diskstime partprobe /dev/sda
# Add sleep after partprobe for safety
partprobe /dev/sdb
sleep 1
# Now partition device nodes should exist# Check device readinesswait_for_device() {
local device=$1local timeout=30
local elapsed=0
while [ $elapsed-lt$timeout ];doif [ -b"$device" ];thenreturn 0
fi
sleep 1
((elapsed++))donereturn 1
}
partprobe /dev/sdb
wait_for_device /dev/sdb1
Large Disk Considerations
# For very large disks (>10TB)# partprobe might be slow# Use timeout
timeout 60 partprobe /dev/sda
# Or use alternative
blockdev --rereadpt /dev/sda
Monitoring and Logging
Log Operations
# Log partprobe operationspartprobe_logged() {
local device=$1
logger -t partprobe "Probing $device"if partprobe "$device"2>&1| tee -a /var/log/partprobe.log;then
logger -t partprobe "Success: $device"return 0
else
logger -t partprobe "Failed: $device"return 1
fi
}
partprobe_logged /dev/sdb
Monitor Kernel Messages
# Watch for partition changes
dmesg -w | grep -E 'sd|partition'&
WATCH_PID=$!# Perform operations
partprobe /dev/sdb
# Wait a bit
sleep 2
# Stop watchingkill$WATCH_PID
Verify Changes
# Before partprobe
BEFORE=$(lsblk /dev/sdb | wc -l)# Run partprobe
partprobe /dev/sdb
# After partprobe
AFTER=$(lsblk /dev/sdb | wc -l)# Compareif [ $AFTER-gt$BEFORE ];thenecho"New partitions detected"elseecho"No new partitions"fi
Security Considerations
Permission Requirements
# partprobe requires root privileges
sudo partprobe /dev/sdb
# Check permissions
ls -l $(which partprobe)# Should be executable by root# Audit partprobe usage
auditctl -w /usr/sbin/partprobe -p x -k partition_probe
Safe Execution
# Verify device is what you expect
EXPECTED_SIZE="1000GB"
ACTUAL_SIZE=$(lsblk -dno SIZE /dev/sdb)if [ "$ACTUAL_SIZE"!="$EXPECTED_SIZE" ];thenecho"Warning: Size mismatch"echo"Expected: $EXPECTED_SIZE"echo"Actual: $ACTUAL_SIZE"read -p "Continue? (yes/no): " confirm
[ "$confirm"!="yes" ] &&exit 1
fi
partprobe /dev/sdb
Common Patterns
Hot-Plug Storage
# After hot-plugging disk# Wait for device to appear
sleep 2
# Partition disk
sgdisk --zap-all /dev/sdb
sgdisk --new=1:0:0 /dev/sdb
# Probe
partprobe /dev/sdb
# Wait for partition
sleep 1
# Use partition
mkfs.ext4 /dev/sdb1
Virtual Machine Disk Expansion
# After expanding VM disk in hypervisor# Rescan SCSI busecho 1 > /sys/class/scsi_device/*/device/rescan
# Reload partition table
partprobe /dev/sda
# Verify new size
lsblk /dev/sda
# Resize partition (if needed)# ... partition resize commands ...# Reload again
partprobe /dev/sda
# Resize filesystem
resize2fs /dev/sda3
partprobe is a critical utility for informing the Linux kernel about partition table changes. While it's a simple command with few options, its role in the partition management workflow is essential. After any partition table modification, partprobe (or its alternatives) must be run to make changes visible to the system without rebooting. Understanding when and how to use partprobe, along with troubleshooting common issues, is fundamental for system administrators managing storage systems.