Puppet:无法添加物理卷

Puppet:无法添加物理卷

我想在 Puppet 中创建一个物理卷。以下是我的代码

class lvm::crelvm {

  physical_volume { '/dev/sdb2':
  ensure    => present
}

 volume_group { 'vg_cas':
     ensure  => present,
     physical_volumes  => '/dev/sdb2',
    }

}

但我收到以下错误

  Error: Execution of '/sbin/pvcreate /dev/sdb2' returned 5: Device /dev/sdb2 not found (or  igored by filtering).
  Error: /Stage[main]/Lvm::Crelvm/Physical_volume[/dev/sdb2]/ensure: change from absent to present failed: Execution of '/sbin/pvcreate /dev/sdb2' returned 5: Device /dev/sdb2 not found (or ignored by filtering).
  Error: Execution of '/sbin/vgcreate vg_cas /dev/sdb2' returned 5: Physical volume /dev/sdb2 not found
   Device /dev/sdb2 not found (or ignored by filtering).
   Unable to add physical volume '/dev/sdb2' to volume group 'vg_cas'.
   Error: /Stage[main]/Lvm::Crelvm/Volume_group[vg_cas]/ensure: change from absent to present failed: Execution of '/sbin/vgcreate vg_cas /dev/sdb2' returned 5: Physical volume /dev/sdb2 not found
   Device /dev/sdb2 not found (or ignored by filtering).
   Unable to add physical volume '/dev/sdb2' to volume group 'vg_cas'.

已经创建了“/dev/sdb1”,并且还在“/dev/sdb1/vg03”下创建了卷组

所以我改变了我的代码如下

 class lvm::crelvm {

 volume_group { 'vg_cas':
 ensure  => present,
 physical_volumes  => '/dev/sdb1',
}

当我编译时,我得到

 Error: Execution of '/sbin/vgcreate vg_cas /dev/sdb1' returned 5: Physical volume '/dev/sdb1' is already in volume group 'vg03'
 Unable to add physical volume '/dev/sdb1' to volume group 'vg_cas'.
 So how can I create new physical volume and add vg_cas volume group on this.

我是 puppet 和 unix 管理的新手。

答案1

Physical volume '/dev/sdb1' is already in volume group 'vg03'<-- 该磁盘是或曾经是卷组的一部分。请先将其从其他卷组中删除。

相关内容