我无法将新卷(由 SAN 存储配置)添加为主机 LVM 卷的 PhysicalVolume。以下是错误消息:
#sudo pvcreate /dev/sdc1 -v
Device /dev/sdc1 not found (or ignored by filtering).
操作系统:Ubuntu 14.04.2 LTS(GNU/Linux 3.16.0-30-generic x86_64)
fdisk:
#sudo fdisk /dev/sdc -l
Disk /dev/sdc: 2198.0 GB, 2197999845376 bytes
237 heads, 20 sectors/track, 905689 cylinders, total 4292968448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 1048576 bytes
Disk identifier: 0x00031fdb
Device Boot Start End Blocks Id System
/dev/sdc1 2048 4292968447 2146483200 8e Linux LVM
分手:
#sudo parted /dev/sdc
GNU Parted 2.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: HP MSA 2040 SAN (scsi)
Disk /dev/sdc: 2198GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 2198GB 2198GB primary lvm
过滤器(仅限未注释的行):
filter = [ "a/.*/" ]
global_filter = [ "a|loop0|", "a|loop1|", "a|sda5|", "r|.*|" ]
部分探测:
sudo partprobe -s
/dev/sda: msdos partitions 1 2 <5>
/dev/sdb: msdos partitions 1 2
/dev/sdc: msdos partitions 1
/dev/sdd: msdos partitions 1
/dev/mapper/devstack--vg-swap_1: loop partitions 1
/dev/mapper/devstack--vg-root: loop partitions 1
到目前为止我已经尝试过:
- fdisk /dev/sdc n,p,1,ENTER 2次,t,8e,w
- (parted)mklabel msdos
- (parted)mklabel gpt
- (parted)mklabel循环
- /dev/sdc 的第一个扇区用零填充
- 零填充的 /dev/sdc
- 零件探测
- 部分探测/dev/sdc
- 重启
答案1
问题在于global_filter
由etc/lvm/lvm.conf
开发栈安装。
我把该行注释掉,现在可以pvcreate
正常使用。
#global_filter = [ "a|loop0|", "a|loop1|", "a|sda5|", "r|.*|" ] # from devstack
感谢@MichaelHampton 的指出。
答案2
不必注释掉整行,而是可以添加要添加的磁盘分区 - 就我而言,我还想添加 /dev/sdc1,因此将该行更改为以下内容:
global_filter = [ "a|loop0|", "a|loop1|", "a|sda5|", "a|sdb5|", "a|sdc1|", "r|.*|" ] # from devstack
此后,pvcreate 命令运行正常。无需重启。
不过,还是感谢您的原始帖子和答案 - 如果没有这些信息,我仍然会试图弄清楚发生了什么。
答案3
我在 Debian 8 上遇到了类似的问题
> lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.7 (jessie)
Release: 8.7
Codename: jessie
> vgextend vg_data /dev/sdc
Device /dev/sdc not found (or ignored by filtering).
Unable to add physical volume '/dev/sdc' to volume group 'vg_data'.
与开篇文章的不同之处在于,我的 global_filter 默认情况下被注释掉,里面没有内容,所以我保持原样。
# global_filter = []
该系统上有 3 个卷组,其中 2 个是在安装时创建的。vg_data 随后从 sdd(与下面的 sdc 相同的控制器)创建,没有错误,整个磁盘为 RAW。
我最终采取了以下步骤:
> parted /dev/sdc
GNU Parted 3.2
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) mkpart primary ext4 1049kB 6000GB
(parted) p
Model: AMCC 9650SE-12M DISK (scsi)
Disk /dev/sdc: 6000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 6000GB 6000GB ext4 primary
(parted) quit
Information: You may need to update /etc/fstab.
> partprobe /dev/sdc
> partprobe /dev/sdc1
我曾希望 lvm 会覆盖分区并将磁盘用作 RAW,但是......
> vgextend vg_data /dev/sdc
Device /dev/sdc not found (or ignored by filtering).
Unable to add physical volume '/dev/sdc' to volume group 'vg_data'.
所以最后我使用了分区和...
> vgextend vg_data /dev/sdc1
Physical volume "/dev/sdc1" successfully created
Volume group "vg_data" successfully extended
耶,vg_data 终于被扩展了
答案4
另一个可能的原因:设备上可能有 RAID 超级块。如果是这样(file -s /dev/sdXN
如果您不想为此安装 mdadm,请使用 ),请使用 将其清零dd if=/dev/zero bs=1k count=10 of=/dev/sdXN
。
不,这个--force
选项pvcreate
还不够。我要提交一个关于此的错误报告。