Partproble cannot update partition information under RHEL 6
In RHEL5.x, after adding disk partitions and other operations, you have been using the partproble command to re-read partition table information from the kernel, so that you do not need to restart. However, a partprobe error occurred recently when using RHEL 6 (Red Hat Enterprise Linux Server release 6.6 (Santiago.
[root@localhost ~]# lsof /dev/sda
[root@localhost ~]# partprobe /dev/sda
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.
The following information is found in the official document "How to use a new partition in RHEL6 without reboot ".
Partprobe was commonly used in RHEL 5 to inform the OS of partition table changes on the disk. in RHEL 6, it will only trigger the OS to update the partitions on a disk that none of its partitions are in use (e.g. mounted ). if any partition on a disk is in use, partprobe will not trigger the OS to update partitions in the system because it is considered unsafe in some situations.
Translation:
Partprobe is usually used in RHEL 5 to notify the Partition Table changes or changes on the disk of the operating system. In RHEL 6, the OS is triggered to update the Partition Table of the disk only when any partition on the disk is not in use (for example, mounted. If any partition on the disk is in use, the partprobe command will not trigger the operating system to update the partition table information, because in some cases, it is considered unsafe.
Solution:
1: restart the operating system. Universal restart, haha. However, in many cases, it is unrealistic because the restart will interrupt the business, and the restart can only be the next policy.
2: Use the partx command to solve this problem.
[root@localhost ~]# partx -l /dev/sdb
# 1: 63-314568764 (314568702 sectors, 161059 MB)
# 2: 314568765-356514479 ( 41945715 sectors, 21476 MB)
# 3: 0- -1 ( 0 sectors, 0 MB)
# 4: 0- -1 ( 0 sectors, 0 MB)
[root@localhost ~]#
[root@localhost ~]# partx -v -a /dev/sdb
device /dev/sdb: start 0 size 356515840
gpt: 0 slices
dos: 4 slices
# 1: 63-314568764 (314568702 sectors, 161059 MB)
# 2: 314568765-356514479 ( 41945715 sectors, 21476 MB)
# 3: 0- -1 ( 0 sectors, 0 MB)
# 4: 0- -1 ( 0 sectors, 0 MB)
BLKPG: Device or resource busy
error adding partition 1
BLKPG: the prompt message "Device or resource busy" is normal, indicating that partition 1 already exists before partition 2 is added.
Read disk and try to add all partitions to the system:
Raw
# partx -v -a /dev/sdb device /dev/sdb: start 0 size 2097152 gpt: 0 slices dos: 4 slices # 1: 63- 505007 ( 504945 sectors, 258 MB) # 2: 505008- 1010015 ( 505008 sectors, 258 MB) # 3: 0- -1 ( 0 sectors, 0 MB) # 4: 0- -1 ( 0 sectors, 0 MB) BLKPG: Device or resource busyerror adding partition 1
(These last 2 lines are normal in this case because partition 1 is already added in the system before partition 2 is added)
For example, after adding and reading partition table information and executing the following command, we will find that partition 2 also reports "BLKPG: Device or resource busy error adding partition 2"
Check the partition node information.
[root@localhost ~]# ls /dev/sdb*
/dev/sdb /dev/sdb1 /dev/sdb2
[root@localhost ~]#
In addition, I found in the test that the solution can also be solved using the following method. For example, the newly added partition is/dev/sdc2/dev/sdb2/dev/sda4, then you can execute the following command to solve the problem.
[root@localhost ~]# partx -a /dev/sdc2 /dev/sdc
[root@localhost ~]# partx -a /dev/sdb2 /dev/sdb
[root@localhost ~]# partx -a /dev/sda4 /dev/sda
References:
Https://access.redhat.com/node/57542
This article permanently updates the link address: