partprobe will not work..i have tried everything

I am days before the RHCSA exam and i have noticed i still haven't been able to successfully run partprobe successfully after months on testing and testing and testing..not a single time

I have tried

partprobe

partprobe /dev/sdx

where sdx is the drive name

It never works. I get a warning saying that the kernel failed to re-read the partition table on /dev/sdx (device or resource busy). As a result it may not reflect all of your changes until after reboot

What can i do?

Yes, parted is installed .


Solution 1:

before running partprobe make sure all partitions of that disk are unmounted. In case you are using lvm you should also inactivate the volumes on that disk with something like "lvchange -an vgname/lvname" before running partprobe again.

Solution 2:

Recently ran into this trying to allocate some unused space on a drive, and the following worked for me:

partx -a /dev/sda

It complained about an in-use partition #1, but added the new partition one #2 and I was able to reference it under /dev/sda2 and do a pvcreate on it and to my volume group. This was after the fdisk & partprobe that didn't work as below

# fdisk -l /dev/sda

Disk /dev/sda: 21.5 GB, 21474836480 bytes
224 heads, 19 sectors/track, 9855 cylinders
Units = cylinders of 4256 * 512 = 2179072 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00006917

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          49      102400   83  Linux
/dev/sda2              49        9855    20868016   83  Linux

# partprobe 
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy).  As a result, it may not reflect all of your changes until after reboot.

# ls /dev/sda*
/dev/sda   /dev/sda1  

# partx -a /dev/sda
BLKPG: Device or resource busy
error adding partition 1

# ls /dev/sda*
/dev/sda  /dev/sda1  /dev/sda2

Solution 3:

partprobe is unsafe. Red Hat recommends partx. For example,

partx -v -a /dev/sdx

And verify if all partitions created

ll /dev/sdx?