Reload Partition Table Without Reboot In Linux

Linux shell is most popular than GUI in Linux systems and most of Linux administrators doing their tasks and system configurations via shell. But shell is most difficult than GUI. They do many thing via shell for example adding new disks or partitions for applications and services.

Sometimes administrators and users faced with the below messages after create new partitions:

WARNING: Re-reading the partition table failed with error 16: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

Or after run “mkfs.extX” command to create file-system on the partition:

Could not stat /dev/sdXX — No such file or directory

The device apparently does not exist; did you specify it correctly?

Actually, kernel couldn’t reload partition table at this situation and ask administrator to reboot the machine for reloading partition table.

What’s Solution?

Partprobe

This utility is the first solution for reloading partition table of the disk. It’s installed on most distribution by default.

Run the below command to reload partition table manually:

partprobe /dev/sdX (X is the device letter)

If Partprobe doesn’t work and the below error message was shown:

Error: Could not stat device /dev/sdX – No such file or directory

Try another solution from the below solutions.

Hdparm

The Hdparm utility is a general hard disk utility in Linux, try the below command to reload partition table:

hdparm -z /dev/sdX (X is the device letter)

Kpartx / Partx

These two utility can reload partition table. Kpartx is generally use for Multipath devices and partx using for local devices:

kpartx -a /dev/sdX (X is the device letter)
partx -v -a /dev/sdX (X is the device letter)

Kernel Interface

If the above utility couldn’t resolve issue, the last solution is last. This solution force kernel to reload the device:

echo 1 > /sys/block/sdX/device/rescan (X is the device letter)

After all if the problem is still exist. There is no solution except rebooting OS!

Davoud Teimouri

Davoud Teimouri is as a professional blogger, vExpert 2015/2016/2017/2018/2019, VCA, MCITP. This blog is started with simple posts and now, it has large following readers.

1 Response

  1. Majid Moradiaghili says:

    this command works for me :
    echo 1 > /sys/block/sdX/device/rescan
    TNX Mr.Davoud
    it was awesome tip.

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newsletter and join other subscribers

Holler Box