≡ Menu

Re-read The Partition Table Without Rebooting Linux System

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.

Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

Comments on this entry are closed.

  • Jeganatham June 21, 2006, 3:28 pm

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

    • S.D October 5, 2010, 12:13 pm

      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.

  • domen December 7, 2006, 12:48 pm

    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”

  • Jason April 17, 2007, 9:29 pm

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

    # hdparm -z /dev/sdX

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

    • Rakesh Gupta June 4, 2011, 4:37 am

      BLKRRPART failed: Device or resource busy

  • James Cassell September 11, 2008, 1:51 am

    Thank You!

    You saved me from having to restart my server!

    (restarting is a real pain in the neck)

  • Romaric September 15, 2008, 8:49 pm

    Thanks a lot !

    And in order to install parted for gentoo users :

    emerge -av parted

    ;)

  • Matti February 12, 2009, 8:30 am

    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. :)

    • Rakesh Gupta May 23, 2011, 1:40 pm

      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 .

      • DaveQB May 24, 2011, 3:09 am

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

  • jason May 27, 2009, 10:21 pm

    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.

  • Schmoove September 2, 2009, 11:12 am

    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 :)

  • Harish October 18, 2009, 5:16 pm

    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.

  • Eric October 24, 2009, 12:32 pm

    on RH systems you may need to run udevstart after partprobe

    • Rakesh Gupta May 23, 2011, 7:08 am

      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???

      • DaveQB May 24, 2011, 2:56 am

        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.

  • DaveQB November 27, 2009, 1:33 am

    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.

  • Nepto November 27, 2010, 2:32 pm

    Thank you very much for this great advice.

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

  • Tony January 5, 2011, 10:09 pm

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

  • Fantomas September 7, 2011, 3:22 pm

    excellent!

    thank you very much!

  • HighKing June 19, 2012, 9:33 am

    Doesn’t seem to work for the disk that houses the root-partition or CentOS/RHEL machines. The resize2fs command simply stats the filesystem is already at maximum size. If I enter a value of 100 blocks less then available resize2fs tells me that the devices is not that big. Any hints?

    – “partprobe” or “partprobe /dev/sda” does not provide any output and nothing is written in dmesg.
    – “hdparm -z /dev/sda” throws me the same “device or resource busy” message as fdisk.
    – “echo 1 > /sys/block/sda/device/rescan” doesn’t help either.

    This is quite annoying as almost all of our machines are virtual machines which we can expand on-the-fly. Even more annoying is the fact that we can accomplish this with just a few clicks on a Windows machine…

  • dylan July 5, 2012, 8:34 pm

    Rakesh Gupta,

    I’m getting the exact same errors. If you run across a fix for centos 6 please let me know.

  • Naren August 30, 2012, 10:35 pm

    I am trying to add partprobe in a bash script after I format the disk.
    but its not rereading the partition table, can you suggest me a way to achieve it?

  • Jay Porter October 10, 2012, 4:32 am

    Hi,

    For those on RH6/CentOS6 wondering why this does not work stop wondering, it never will. Due to stupid people frying their systems playing with partitions on the side the device will always block you with “BUSY” if there is even one active partition on a disk still in use. This was implemented by one of the developers, cant remember where I saw it but it was on BugZilla somewhere listed as a bug.

    For example:

    sda1 – In use
    sda2 – Not in use

    If you modify the partition data for sda2 and try to get it to reread in live without a reboot it will throw a device busy because sda1 is still active and in use. This at the end of the day is always going to lead to one of two paths, kill everything, unmount everything and try again or reboot. Both result in the same case scenario anyway, downtime of services.

    You can rescan the bus for the devices but that wont reread in the partition information, only physical disk size. So you will have a disk that now accurately reflects the increase, say from 10GB to 20GB but you still wont be able to resize the partition to fill the space because the kernel cant reread in the changes to it you have made until after a reboot.

    Please, if someone wants to point this out as being incorrect I beg of you please go right ahead because I seem to just keep running into dead ends.

    • Kuba Ober February 4, 2015, 9:27 pm

      The solution is rather simple: the 1st disk should have a small /boot partition, and the rest should be a single LVM physical volume. That’s why I’ve never bothered with that sort of a problem in years. LVM makes life quite wonderful, and offers features that don’t exist even on Windows :)

  • Jay Porter October 10, 2012, 4:33 am

    Hi,

    Further to my comment above here is the bug report I deduced this from:

    https://bugzilla.redhat.com/show_bug.cgi?id=614357

    Regards,
    Jay

  • fubupc December 19, 2012, 5:59 am

    @Jay Porter, your problem should be caused by old version parted . After I upgrade from 2.1 ( centos6.3 default ) to 3.1 (build from source). I can happily make/delete partitions without booting now!

    • Chandan February 15, 2013, 10:12 pm

      Looks like it is problem with older version parted. So gist of the story if you don’t have parted 3.1 in your system be ready to reboot your system. As none of the technique seems to work on RHEL 6

  • Ben January 8, 2013, 4:26 pm

    @fubupc
    new parted(3.1) cann’t reload partition table for me when some program use one partition.

  • sudo sudo February 20, 2014, 1:07 pm

    Just FYI

    Also check if any partition is not part of a logical volume. You can use the pvdisplay command, it helped a lot. This was on Centos.

  • Justin March 12, 2014, 11:24 pm

    Anyone else still having trouble with this, I found a solution for RHEL 6 somewhere else

    Read the partition table with partx -a /dev/sda

    It spits out an error but the second time I ran partx it showed the 3rd partition I created with cfdisk.

  • HappyMike June 14, 2014, 2:38 pm

    @Justin
    Thx
    i’ve solve my problem with
    sudo partx -u /dev/sda (as -a reported some errors)
    sudo resize2fs /dev/sda1

    • gkasap April 21, 2015, 3:19 pm

      @HappyMike you have saved me.
      I’ve tried all other ways listed above but none works in CentOS6.4
      Using partx (twice) read the new partition.

      Thanks alot

  • Zain July 10, 2014, 4:45 am

    Is there any equivalent for rereading the partition table without reboot on windows using an NTFS file system ?

  • Justin Edmands August 7, 2014, 10:17 pm

    If you are using RHEL/CENTOS6 with LVM do the following:

    example:
    -/dev/sdb1 was created and is LVM partition.
    -In VMware I extended the Virtual Disk file an extra 100GB
    -I added a new partition called /dev/sdb2
    -OS states I need to run kpartx or partprobe
    -OS states drive is busy and cannot continue

    In order to get the drive working, I did the following;

    umount /mnt/
    vgchange -an vg_data
    blockdev –rereadpt /dev/ (ex /dev/sdb not /dev/sdb1,2,3,4…)
    vgchange -ay
    pvcreate /dev/sdb2

    • zain August 9, 2014, 3:05 pm

      Any idea how to do this on windows ?