博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
partproble在RHEL 6下无法更新分区信息
阅读量:7221 次
发布时间:2019-06-29

本文共 2849 字,大约阅读时间需要 9 分钟。

在RHEL5.x版本下面,在添加磁盘分区等操作后,一直使用partproble命令使内核重新读取分区表信息,从而不用重新启动。但是最近在RHEL 6(Red Hat Enterprise Linux Server release 6.6 (Santiago))下,使用partprobe出现错误。

[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.

 

后面查了一下资料发现,在官方文档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.

 

 

翻译如下:

partprobe通常在RHEL 5中用来通知操作系统的磁盘上的分区表变化或更改。在RHEL 6中,只有当那些磁盘上任何分区都没有在使用的磁盘下(例如,mounted)它才会触发OS去更新磁盘的分区表。如果磁盘上的任何分区正在使用中,partprobe命令不会触发操作系统去更新分区表的信息,因为在某些情况下,它被认为是不安全的。

解决方案:

 

1:重启操作系统。万能的重启,哈哈,不过,在很多情况下是不现实的,因为重启会中断业务,重启只能是下下策。

2:使用partx命令来解决这个。

[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: Device or resource busy 这个提示信息是正常,表示分区1在分区2添加前已经存在了。

Read disk and try to add all partitions to the system:

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

例如在添加、读取分区表信息后,再执行下面命令,就会发现分区2也报“BLKPG: Device or resource busy error adding partition 2”

检查分区节点信息。

[root@localhost ~]# ls /dev/sdb*
/dev/sdb  /dev/sdb1  /dev/sdb2
[root@localhost ~]#

 

另外,我在测试中,发现也可以使用下面方法里解决,例如新增的分区是/dev/sdc2/ /dev/sdb2/ /dev/sda4,那么就可以执行如下命令解决问题。

[root@localhost ~]# partx -a /dev/sdc2 /dev/sdc
 
[root@localhost ~]# partx -a /dev/sdb2 /dev/sdb
 
[root@localhost ~]# partx -a /dev/sda4 /dev/sda

 

参考资料:

转载地址:http://fuhym.baihongyu.com/

你可能感兴趣的文章
ovirt节点直接使用virsh操作vm需要用户名密码
查看>>
Netsuite宣布大规模全球扩张计划
查看>>
阳煤化工与8Manage签约提升研发项目管理效率
查看>>
SiteMesh2-标签库
查看>>
plsql导入excel时报错:ORA-01036: 非法变量名/编号
查看>>
深入浅出串口编程(1)――基本概念
查看>>
图示SaaS:走向平台化,会产生什么变化?
查看>>
[APEC中小企业峰会2009上]对话:经济适用男 vs 超级豪华男
查看>>
linux kernel的中断子系统之(三):IRQ number和中断描述符【转】
查看>>
addChild()和addChildAt(,index)的区别
查看>>
IBM:SQL注入攻击第三波浪潮袭来
查看>>
android131 360 02 设置中心
查看>>
【HoorayOS】Web桌面应用框架(第五版 v120704)
查看>>
读书笔记:《思考的乐趣:Matrix67数学笔记》第4章 统计数据的陷阱
查看>>
数据库的快照隔离级别(Snapshot Isolation)
查看>>
linux中断申请之request_threaded_irq 【转】
查看>>
sessionid如何产生?由谁产生?保存在哪里?
查看>>
字节流套接口的读写
查看>>
Git 二分调试法,火速定位疑难Bug!
查看>>
ArcGIS Engine 编辑- ITask
查看>>