暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

逻辑卷常见错误

IT运维大爆炸 2022-11-14
1117

1、无法初始化物理量,之前创建的cinder-volumes没有卸载

Can't initialize physical volume "/dev/sdb" of volume group "cinder-volumes" without -ff dev/sdb: physical volume not initialized.

方法一:

[root@storage cinder]# lsblk
NAME       MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda           8:0    0   20G  0 disk
├─sda1        8:1    0   1G  0 part boot
└─sda2        8:2    0   19G  0 part
├─cl-root 253:0    0   17G  0 lvm
└─cl-swap 253:1    0   2G  0 lvm [SWAP]
sdb           8:16   0   20G  0 disk
sr0          11:0    1  4.1G  0 rom  
[root@storage cinder]# pvcreate -ff -y dev/sda1   执行命令后重新创建即可
Device dev/sda1 excluded by a filter.
[root@storage cinder]# pvcreate -ff -y dev/sdb
' Physical volume "/dev/sdb" successfully created.

[root@storage cinder]# vgcreate cinder-volumes dev/sdb
Volume group "cinder-volumes" successfully created

方法二:

按顺序先后卸载逻辑卷、卷组(必要时还要卸载物理卷):

[root@storage cinder]# lvremove dev/cinder-volumes/LogVol00**

[root@storage cinder]# vgremove cinder-volumes

成功卸载后再重新执行sudo pvcreate dev/cciss/c0d1p1,不再有错误发生。

接着执行后续动作来创建LVM。

2、创建pv卷报错Device dev/sdb2 excluded by a filter的解决方法

创建pv卷报错Device dev/sdb2 excluded by a filter,原因大概是之前装的windows系统,改为了linux系统,无法找到分区表导致,需要重建下分区表。

具体操作如下:

[root@localhost ~]# 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                                                    
Warning: 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) quit                                                            
Information: You may need to update etc/fstab.

然后在重新分区,重新创建pv创建成功。

在创建的时候会提示是否擦除NTFS的签名,选择yes即可

[root@localhost ~]# pvcreate dev/sdb1
WARNING: ntfs signature detected on dev/sdb1 at offset 3. Wipe it? [y/n]: y
Wiping ntfs signature on dev/sdb1.
Physical volume "/dev/sdb1" successfully created.

3、xfs和ext4两种扩容方式

#若不是xfs我们可以用resize2fs
[root@Mysql01-213-66 ~]# resize2fs -f /dev/mapper/vg_mysql0121366-LogVol01
resize2fs 1.41.12 (17-May-2010)
resize2fs: Bad magic number in super-block while trying to open /dev/mapper/vg_mysql0121366-LogVol01
Couldn't find valid filesystem superblock.

#xfs扩容方式
[root@Mysql01-213-66 ~]# xfs_growfs /dev/mapper/vg_mysql0121366-LogVol01
meta-data=/dev/mapper/vg_mysql0121366-LogVol01 isize=256    agcount=4, agsize=524288 blks
        =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=2097152, imaxpct=25
        =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal               bsize=4096   blocks=2560, version=2
        =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 2097152 to 7077888

欢迎大家扫码关注:

本公众号只写原创,不接广告、不接广告、不接广告。下期小伙伴想学习什么技术,可以私信发我吆。


文章转载自IT运维大爆炸,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论