Re-read The Partition Table Without Rebooting Linux System

by Vivek Gite on May 8, 2006 · 20 comments

If you are using hot swappable hard disk and created new partition using fdisk then you need to reboot Linux based system to get partition recognized. Without reboot you will NOT able to create filesystem on your newly created or modified partitions with the mke2fs command.

However with partprobe command you should able to create a new file system without rebooting the box. It is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table.

After the fdisk command session (which makes changes to partition table) just type the following command:
# partprobe
OR
# partprobe /dev/sdX
Replace /dev/sdX or /dev/hdX with actual device name. Now you will able to create filesystem on new partition with the mke2fs command.

Inform the OS of partition table changes

partprobe command is part of GNU parted software. parted is a disk partitioning and partition resizing program. It allows you to create, destroy, resize, move and copy ext2, ext3, linux-swap, FAT, FAT32, and reiserfs partitions. It can create, resize and move Macintosh HFS partitions, as well as detect jfs, ntfs, ufs, and xfs partitions. It is useful for creating space for new operating systems, reorganising disk usage, and copying data to new hard disks.

Install parted

In order to use partprobe command you need to install parted:
If you are using Debian / Ubuntu Linux, enter:
# apt-get install parted
OR if you are using RHEL version <= 4, enter:
# up2date parted
OR if you are using Fedora Linux / CentOS / RHEL 5, enter:
# yum install parted

See also:

=> See official parted home page for download and other information.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

{ 20 comments… read them below or add one }

1 Jeganatham June 21, 2006

Its a very good tip that can be used in a production evironment without any downtime

Reply

2 S.D October 5, 2010

partprobe won’t always work. If you are lucky hdparm -z will work, but again cannot be guartenteed. The problem with Linux and partition tables carries on into the 21st century’s second decade.

Reply

3 domen December 7, 2006

Thank you!

And to make this a bit more googlable:
fdisk printout: “Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy”

Reply

4 Jason April 17, 2007

When partprobe isn’t available you can also (sometimes) use:

# hdparm -z /dev/sdX

which will re-read that device’s partition table.

Reply

5 Rakesh Gupta June 4, 2011

BLKRRPART failed: Device or resource busy

Reply

6 James Cassell September 11, 2008

Thank You!

You saved me from having to restart my server!

(restarting is a real pain in the neck)

Reply

7 Romaric September 15, 2008

Thanks a lot !

And in order to install parted for gentoo users :

emerge -av parted

;)

Reply

8 Matti February 12, 2009

Thanks for the tips (LINUXTITLI, Jason) and also thanks domen for making this more googlable!

Created a new partition from unformatted disk space (got error in re-reading the partition table: device busy) , partprobed, mkfs.ext3′d, e2labeled and mounted!
No reboot needed, thanks again. :)

Reply

9 Rakesh Gupta May 23, 2011

i am run this command in rhel6 .and i want without reboot update partition table.when i am use partprobe ,kpartx, and hdperm -z command .
system are given massage device or resource busy due to failed .

Reply

10 DaveQB May 24, 2011

Try stopping services like samba and nfs. I found restarting nfs freed up my disk even after I used fdisk on it.

Reply

11 jason May 27, 2009

I found this website while I was trying to figure out what the difference between the three ways I’ve found so far (partprobe, hdparm -z /dev/disk, and blockdev –rereadpt /dev/disk) is.

Reply

12 Schmoove September 2, 2009

Boy was I happy to find this post. Just added a new partition to my gentoo production server after 463 days uptime and stumbled across the above mentioned ioctl warning. Thanks guys for the post and the comments :)

Reply

13 Harish October 18, 2009

Never was able to get the disk formatting re-read using partprobe. Had to reboot servers. May be to note that I am working on Redhat clusters with gfs. That shouldn’t matter much, as I run partprobe on both nodes.

Reply

14 Eric October 24, 2009

on RH systems you may need to run udevstart after partprobe

Reply

15 Rakesh Gupta May 23, 2011

i am run this command in rhel6 .and i want without reboot update partition table.when i am use partprobe ,kpartx, and hdperm -z command .
system are give massage device or resource busy due to failed .
so what are doing me pls help???

Reply

16 DaveQB May 24, 2011

I found that even after all the fdisk’ing, the partition/disk was still in use. Ended up being nfs (even though I was not sharing that disk any more and had run exportfs -av a few times). I had to restart nfs server to free the disk, then partprobe worked.

I thought I was heading for a reboot.

Reply

17 DaveQB November 27, 2009

A 4th way is:

echo 1 > /sys/block/sdc/device/rescan

And follow dmesg to see the kernel rescan the disk. I found this worked on a server that partprobe did not.

Reply

18 Nepto November 27, 2010

Thank you very much for this great advice.

Btw, if you want to know what partitions kernel sees, glance at the /proc/partitions file

Reply

19 Tony January 5, 2011

Thank you, I was going crazy trying to figure out why my table was not refreshing. Thank you,,,thank you,,,thank you.

Reply

20 Fantomas September 7, 2011

excellent!

thank you very much!

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 4 + 13 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: