pvcreate not able to initialize physical volume

0

I got some application which will call the pvcreate each time.

I can see the volumes in my vm as follow:

$ pvscan

  PV /dev/vda5   VG ubuntu-vg       lvm2 [99.52 GiB / 0    free]
  Total: 1 [99.52 GiB] / in use: 1 [99.52 GiB] / in no VG: 0 [0   ]

$ pvcreate --metadatasize=128M --dataalignment=256K '/dev/vda5'

Can't initialize physical volume "/dev/vda5" of volume group "ubuntu-vg" without -ff

$ pvcreate --metadatasize=128M --dataalignment=256K '/dev/vda5' -ff

Really INITIALIZE physical volume "/dev/vda5" of volume group "ubuntu-vg" [y/n]? y
  Can't open /dev/vda5 exclusively.  Mounted filesystem?

I have also tried wipsfs and observed the same result for above commands

$ wipefs -af /dev/vda5

/dev/vda5: 8 bytes were erased at offset 0x00000218 (LVM2_member): 4c 56 4d 32 20 30 30 31

How can I execute pvcreate? Anything to be added for my vm?

lvm
asked on Stack Overflow Jan 16, 2018 by R_SS

1 Answer

1

It seems your hdd (/dev/vda5) is already been used in your ubuntu-vg. I think you can not use same hdd partition in 2 different PV's. or you can not add it again.

answered on Stack Overflow Jan 26, 2018 by asmudeen

User contributions licensed under CC BY-SA 3.0