对一块磁盘进行重复分区(创建如/dev/vg01/lv01的逻辑卷)进行pvcreate操作会报错Can't initialize physical volume "/dev/sdb1" of volume group "vg01" without -ff。根据提示需要加-ff选项进行强制执行,如果还没有挂载可以使用-ff可以解决。但如果已经挂载,则即使使用-ff选项也会报错Can‘t open /dev/sdb1 exclusively. Mounted filesystem?。如下:本文地址:http://www.04007.cn/article/1106.html,未经许可,不得转载.
#pvcreate -v /dev/sdb1 可能遇到的问题情况 [root@centos]# pvcreate -v /dev/sdb1 4:Warning: The existing disk label on /dev/vdb will be destroyed and all data on this disk will be lost. Do you want to continue? Error: Partition(s) 1 on /dev/sdb have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. 6:Yes/No?Yes [root@centos]# pvcreate -v /dev/sdb1 WARNING: Device /dev/sdb1 has size of 195312467 sectors which is smaller than corresponding PV size of 209715133 sectors. Was device resized? One or more devices used as PVs in VG vg01 have changed sizes. Can't initialize physical volume "/dev/sdb1" of volume group "vg01" without -ff /dev/sdb1: physical volume not initialized. [root@centos]# pvcreate -ff -v /dev/sdb1 Really INITIALIZE physical volume "/dev/sdb1" of volume group "vg01" [y/n]? y WARNING: Forcing physical volume creation on /dev/sdb1 of volume group "vg01" Can‘t open /dev/sdb1 exclusively. Mounted filesystem?这时有两个方法来处理:
一是按顺序先后卸载逻辑卷、卷组,成功卸载后再重新执行pvcreate。
接着执行后续动作来创建LVM。
[root@centos]# lvremove /dev/vg01/lv01
[root@centos]# vgremove vg01
[root@centos]# pvcreate -ff -v /dev/sdb1
也可以从/dev/mapper/找到挂载点,查看当前已经存在的vg01-lv01。使用dmsetup移除挂载后
[root@centos]# ll /dev/mapper/
lrwxrwxrwx 1 root root 7 Mar 2 14:06 vg01-lv01 -> ../dm-2
[root@centos]# dmsetup remove vg01-lv01
[root@centos]# pvcreate -ff -v /dev/sdb1本文地址:http://www.04007.cn/article/1106.html,未经许可,不得转载.
本文地址:http://www.04007.cn/article/1106.html 未经许可,不得转载. 手机访问本页请扫描右下方二维码.
![]() |
![]() |
手机扫码直接打开本页面 |