nixCraft Poll

Topics

Re-read the partition table without rebooting Linux system

Posted by Vivek Gite [Last updated: October 19, 2007]

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 new file system without a reboot. 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 fdisk session just type command:
# partprobe
Now you will able to create filesystem on 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.

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Jeganatham Says:

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

  2. domen Says:

    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”

  3. Jason Says:

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

    # hdparm -z /dev/sdX

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

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , ,

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.