cancel
Showing results for 
Search instead for 
Did you mean: 
Ad_astra
Flight Engineer Flight Engineer
Flight Engineer
  • 357 Views

Using redhat.rhel_system_roles.storage on a disk where an LVM has been removed

Jump to solution

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 

Labels (1)
1 Solution

Accepted Solutions
Chetan_Tiwary_
Community Manager
Community Manager
  • 317 Views

@Ad_astra You mean you set it to false right , because the default mode is True :

Chetan_Tiwary__0-1725480527707.png

Screenshot from 2024-09-05 01-53-51.png

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.

View solution in original post

3 Replies
Ad_astra
Flight Engineer Flight Engineer
Flight Engineer
  • 340 Views

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

Chetan_Tiwary_
Community Manager
Community Manager
  • 318 Views

@Ad_astra You mean you set it to false right , because the default mode is True :

Chetan_Tiwary__0-1725480527707.png

Screenshot from 2024-09-05 01-53-51.png

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.

Ad_astra
Flight Engineer Flight Engineer
Flight Engineer
  • 290 Views

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

Join the discussion
You must log in to join this conversation.