1

I want to create a physical volume in Puppet. Below is my code

class lvm::crelvm {

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

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

}

But I am getting the below error

  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'.

Already '/dev/sdb1' was created and volume group also created under /dev/sdb1/vg03'

So I changed my code like below

 class lvm::crelvm {

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

When I compile, I get

 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.

I am newbie to puppet and unix admin.

Sven
  • 98,649
  • 14
  • 180
  • 226
Olive
  • 25
  • 2
  • 5
  • What are you actually trying to do here? What do you want your partitions and filesystems to actually look like in the end? – Zoredache Nov 16 '14 at 20:36

1 Answers1

0

Physical volume '/dev/sdb1' is already in volume group 'vg03' <-- That disk is, or was, already part of an volume group. Remove it from the other volume group first.

Zoredache
  • 130,897
  • 41
  • 276
  • 420