创建VG LVM时,报错"Device /dev/sdb excluded by a filter"

  • 创建pv时,发现sdd磁盘报错,被筛选器排除了,这是什么原因呢
[root@server ~]# pvcreate /dev/sdd /dev/sde

Device /dev/sdd excluded by a filter.
Physical volume "/dev/sde" successfully created.

  • 并且sdd磁盘也无法格式化,必须加-f强制格式化才行,提示已经存在一个文件系统了,看到这里大概就猜到了,因为存在一个文件系统,所有无法直接创建新的文件系统
[root@server ~]# mkfs.xfs /dev/sdd
mkfs.xfs: /dev/sdd appears to contain an existing filesystem (linux_raid_member).
mkfs.xfs: Use the -f option to force overwrite.

##我们创建一个新的磁盘看下有什么不同

方法一

  • 格式化文件系统,再进行pv创建

方法二

  • parted重新创建分区表

##找一个同样报错的磁盘sdf

[root@Server]#  parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel msdos                                                    
(parted) print                                                            
Model: AVAGO MR9361-8i (scsi)
Disk /dev/sdb: 70.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

Number  Start  End  Size  Type  File system  Flags

(parted) quit
Information: You may need to update /etc/fstab.

[root@anybackup AnyBackupServer]# vgcreate datavg /dev/sdb
WARNING: dos signature detected on /dev/sdb at offset 510. Wipe it? [y/n]: y
  Wiping dos signature on /dev/sdb.
  Physical volume "/dev/sdb" successfully created.
  Volume group "datavg" successfully created

 

##也没有解决啊!
[root@server ~]# pvcreate /dev/sdf
Can't open /dev/sdf exclusively. Mounted filesystem?
Can't open /dev/sdf exclusively. Mounted filesystem?

##根据报错,查看下是否有挂载

[root@server ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
devtmpfs 476M 0 476M 0% /dev
tmpfs 487M 0 487M 0% /dev/shm
tmpfs 487M 7.7M 479M 2% /run
tmpfs 487M 0 487M 0% /sys/fs/cgroup
/dev/sda3 20G 2.6G 17G 14% /
/dev/sda1 197M 110M 88M 56% /boot
tmpfs 98M 0 98M 0% /run/user/0

[root@server ~]# umount /dev/sdf
umount: /dev/sdf: not mounted
##终于查到sdf在raid5中是激活状态,被用做raid盘,关闭就好了
[root@server ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md5 : active (auto-read-only) raid5 sdg[3] sdf[4]
41908224 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/2] [U_U]

[root@server ~]# mdadm -S /dev/md5
mdadm: stopped /dev/md5
[root@server ~]# pvcreate /dev/sdf
WARNING: dos signature detected on /dev/sdf at offset 510. Wipe it? [y/n]: y
Wiping dos signature on /dev/sdf.
Physical volume "/dev/sdf" successfully created.
THE END