Linux運維遇見Device devsdb excluded by a filter如何解決

保哥有一臺伺服器,以前安裝的是Windows2016作業系統。近期,業務部署需求發生改變,需要安裝rhel7。6。安裝完作業系統後,開始掛載剩餘的儲存空間。建立lv的時候提示:Device /dev/sdb excluded by a filter。

操作步驟

1,檢視以前Windows2016伺服器下的空閒分割槽。

[root@gctn-east-p01 ~]# fdisk -lDisk /dev/sdb: 4798。3 GB, 4798283776000 bytes, 9371648000 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 262144 bytes / 1048576 bytesDisk label type: gptDisk identifier: 58520033-4270-43FF-87E5-CA79567EC17F# Start End Size Type Name1 34 262177 128M Microsoft reser Microsoft reserved partitionPartition 1 does not start on physical sector boundary。2 264192 9371645951 4。4T Microsoft basic Basic data partition

2,刪除該分割槽/dev/sdb

[root@gctn-east-p01 ~]# fdisk /dev/sdbWARNING: fdisk GPT support is currently new, and therefore in an experimental phase。 Use at your own discretion。Welcome to fdisk (util-linux 2。23。2)。Changes will remain in memory only, until you decide to write them。Be careful before using the write command。Command (m for help): dPartition number (1,2, default 2):Partition 2 is deletedCommand (m for help): dSelected partition 1Partition 1 is deletedCommand (m for help): wThe partition table has been altered![root@gctn-east-p01 ~]# pvcreate /dev/sdbDevice /dev/sdb excluded by a filter

解決方案

導致問題的原因是新增的磁碟是在另一個虛擬機器中新建的,已經有了分割槽表,現在的虛擬機器並不能識別磁碟的分割槽表,執行parted命令重做分割槽表,中途需要輸入三次命令。

# parted /dev/sdbGNU Parted 3。2Using /dev/sdbWelcome to GNU Parted! Type ‘help’ to view a list of commands。(parted) mklabel msdosWarning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost。 Do you want to continue?Yes/No? yes(parted) quitInformation: You may need to update /etc/fstab。

再次執行pvcreate,問是否擦除dos簽名,輸入y,就可以將磁碟建立為PV了。

root@host1:~# pvcreate /dev/sdbWARNING: dos signature detected on /dev/sdb at offset 510。 Wipe it? [y/n]: yWiping dos signature on /dev/sdb。Physical volume “/dev/sdb” successfully created。