partproble在RHEL 6下無法更新分區資訊,partproblerhel

來源:互聯網
上載者:User

partproble在RHEL 6下無法更新分區資訊,partproblerhel

在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:

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)

例如在添加、讀取分區表資訊後,再執行下面命令,就會發現分區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

 

參考資料:

https://access.redhat.com/node/57542

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.