Hello
I am learning how to use the redhat.rhel_system_roles.storage role and have found it is not possible to add a new LVM after removing a previous LVM.
For example, setting the 'state' of an existing LVM (created in a playbook) to 'absent' will remove the volume group and logical volume. The disk is shown as 'empty' in lsblk and parted shows the Partition Table as 'unknown'.
However, running a second playbook that attempts to create another LVM on the same (empty?) disk results in the following error:
"cannot remove existing formatting"
I have found the only way to clear the error and allow the playbook to create a new LVM is to use the 'dd' command as follows:
dd if=/dev/zero of=/dev/sdb bs=1M count=10
Is this the correct solution or have I missed some option in the storage role that I should be using?
Any advice is welcome.
Many thanks
@Ad_astra You mean you set it to false right , because the default mode is True :
This command : dd if=/dev/zero of=/dev/sdb bs=1M count=10 is a workaround to erase /overwrite the partition table so that it can be resued by the storage role to create the LVM. Yes, it is not recommended and should be only done with backup.
Well, I think I have already found a solution to my own problem!
I set the storage_safe_mode: false in the playbook and now I can create LVMs on previously used disks. Obviously, you might not want to do this in a production environment as it will clobber any existing disk formatting and you will lose data!
As usual; any comments or advice are most welcome!
Thank you
@Ad_astra You mean you set it to false right , because the default mode is True :
This command : dd if=/dev/zero of=/dev/sdb bs=1M count=10 is a workaround to erase /overwrite the partition table so that it can be resued by the storage role to create the LVM. Yes, it is not recommended and should be only done with backup.
Hi
Yes, I did mean that I set it to false and not true. I shall edit my reply to make more sense!
Thanks for your help
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.