≡ Menu

HowTo: Reload (re-read) Partition Table In Ubuntu Linux

How do I reload the partition table in Ubuntu Linux without rebooting the systems?

You need to install the parted package as follows
sudo apt-get update
sudo apt-get install parted

Once installed type the following command to re-read / reload the partition:
sudo partprobe
Finally, use mkfs.ext3 or mkfs.ext4 to create the file systems:
sudo mkfs.ext3 /dev/sdXY
Make sure you replace /dev/sdXY with actual device name and be careful do not type wrong device same. You may end up destroying working data. Please note that on server with RAID and SAS disk you may need to type the following command to rescan changes:
sudo echo 1 > /sys/block/sdd/device/rescan
sudo fdisk -l
sudo mkfs.ext3 /dev/sdXY

Again replace sdd with actual device name. Please note that above commands should work with all Linux distributions.

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 10 comments… add one }
  • Swapneel May 25, 2010, 8:44 pm

    Strange, Ubuntu doesn’t come with partprobe by default. RPM based distros like Redhat, Fedora and CentOS have it by default.

  • Nilesh May 27, 2010, 4:28 am

    Not only RPM, even Arch Linux and others if you use the default installation configuration.

    Ubuntu, Debian has always been weird and different from others !! :)^

    One who is used to RPM and others will have a tough time migrating to Debain/Ubuntu and vice-versa as it happened to me, though not migrating. Had to help a friend setup his Ubuntu VPS.

  • Anonymous June 2, 2010, 12:11 am

    sudo hdparm -z

  • Mr. Pink June 2, 2010, 12:14 am

    sudo hdparm -z
    You linux people have to do everything through the rectum. The more complicated the better.

    • Anders June 10, 2010, 6:34 pm

      You might want to tell “us” how it should be done.

      • Mr. Pink October 3, 2011, 12:53 am

        In the era of multicore multiGHz CPUs, multiGB RAM and multiTB hard drives you would think that Linux could handle it autoFUCKINGmaticaly.
        Can you imagine how many man/hours around the world are wasted on doing this by hand, while system could do it in a fraction of a second. So here. Now I told how it should be done. Do you think it took a lot of brain power? You could probably come up with it on your own, but then again you’re Linux user. It’s all about being a slave to your computer, isn’t it?

        • Anders October 4, 2011, 3:53 am

          Sorry, but you still have to tell. HOW to do it without causing any other problem, like losing data.
          What you have done here is just been ranting like you actually know HOW to do this. But you have just told us how you WANT it to be done, not HOW it actually NEEDS to be done, without losing any data.
          But I guess it is easier to produce hot air then actually producing a sollution and/or some real code…

  • mark October 22, 2010, 10:24 am


  • xew March 24, 2011, 11:07 am

    I don’t think this works :
    sudo echo 1 > /sys/block/sdd/device/rescan

    You have to start a new shell with sudo, like this :
    sudo bash -c “echo 1 > /sys/block/sdd/device/rescan”

    Otherwise only echo is done with sudo permissions. The redirection “>” is done by your current shell which does not have sudo permissions.

  • stv June 6, 2016, 10:59 pm

    sudo -i

    # locate the scsi_disk

    ll /sys/class/scsi_disk/
    lrwxrwxrwx 1 root root 0 Mar 17 08:03 2:0:0:0 -> ../../devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/scsi_disk/2:0:0:0
    lrwxrwxrwx 1 root root 0 Mar 17 08:03 2:0:1:0 -> ../../devices/pci0000:00/0000:00:10.0/host2/target2:0:1/2:0:1:0/scsi_disk/2:0:1:0
    lrwxrwxrwx 1 root root 0 Mar 17 08:03 2:0:2:0 -> ../../devices/pci0000:00/0000:00:10.0/host2/target2:0:2/2:0:2:0/scsi_disk/2:0:2:0
    lrwxrwxrwx 1 root root 0 Mar 17 08:03 2:0:3:0 -> ../../devices/pci0000:00/0000:00:10.0/host2/target2:0:3/2:0:3:0/scsi_disk/2:0:3:0

    # In our case we have expanded the last disk (/devices/pci0000:00/0000:00:10.0/host2/target2:0:3/2:0:3:0/scsi_disk/2:0:3:0)
    # rescan the device

    echo 1 > /sys/class/scsi_disk/2\:0\:3\:0/device/rescan

    # create the new partition
    fdisk /dev/sdd
    # type “n”
    # write the partition number. e.g. “2”
    # type “t”
    # On Debian, CentOS 6 etc. is “8e”, on CentOS 7 “15”
    # type “w” to write to disk
    # As we already know write will fail

    # to re-read the partitions properly run partx on the device

    partx -v -a /dev/sdd
    # just for the sake of it
    pvcreate /dev/sdd2

    # add the physical volume to the corresponding volume group
    vgextend mainvg /dev/sdd2

    # confirm the disk has been added
    VG #PV #LV #SN Attr VSize VFree
    mainvg 5 6 0 wz–n- 102.90g 35.07g

    # expand the capacity of the logical volume
    lvextend -L+10G /dev/mainvg/LVopt

    # expand the file system capacity
    xfs_growfs /dev/mainvg/LVopt

    # df -hT to confirm all is done
    df -hT

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , ,