Kickstart zerombr - The Volume Group is already in Use

Latest response

Hi,

I have inherited a kickstart file. I was trying to use the kick start to destroy the disk and create some partitions.

This is part of what I inherited.

clearpart --all --initlabel --drives=sda,sdb
part /boot --fstype ext3 --size=512 --ondisk=sda
part pv.2 --size=100 --grow --ondisk=sda
part pv.3 --size=100 --grow --ondisk=sdb
volgroup vg00 --pesize=32768 pv.2 pv.3
logvol / --fstype ext3 --name=slashvol --vgname=vg00 --size=10240
logvol /var --fstype ext3 --name=varvol --vgname=vg00 --size=4096
logvol /local/mnt --fstype ext4 --name=localmntvol --vgname=vg00 --size=4096 --grow
logvol swap --fstype swap --name=swapvol --vgname=vg00 --size=12030"

When some machines were reimaged the kickstart stopped and the error message "The volume group name "vg00" is already in use".

Is a reasonable fix to change the disk section so that is reads

zerombr
clearpart --all
part /boot --fstype ext3 --size=512 --ondisk=sda
part pv.2 --size=100 --grow --ondisk=sda
part pv.3 --size=100 --grow --ondisk=sdb
volgroup vg00 --pesize=32768 pv.2 pv.3
logvol / --fstype ext3 --name=slashvol --vgname=vg00 --size=10240
logvol /var --fstype ext3 --name=varvol --vgname=vg00 --size=4096
logvol /local/mnt --fstype ext4 --name=localmntvol --vgname=vg00 --size=4096 --grow
logvol swap --fstype swap --name=swapvol --vgname=vg00 --size=12030"

I read that initlabel is deprecated. Is there any harm in removing --initlabel and adding zerombr ? Is there another way to get rid of the ..already in use message? I just went onto the machine that was having trouble and fdisked it.

Thanks,

Responses

What version of RHEL are you kickstarting? (I assume RHEL 6).

I use the following on my RHEL 6 kickstart

zerombr
bootloader --location=mbr --driveorder=sda,sdb,sdc,sdd --append="rhgb quiet crashkernel=auto"
clearpart --all --initlabel 
#ignoredisk --only-use=sda

It is NOT universal though - I have to modify it based on a number of factors (i.e. whether there is more than one LUN present, whether I want to wipe ALL the drives/or just certain ones... and the worst one, if I am kickstarting a Dell box that the first drive that the OS sees is actually sdc)

Or an HP box presenting SmartArray LUNs where the disks are cciss rather than sdX. :p

One option (hack) is to manually clear the labels as part of a pre-install script.
I've had to use this at times to properly clear labels on older RHEL versions.

%pre
#!/bin/bash
#
# This script compensates for limitations in the clearpart and part directives that 
# will set alternate partition label names if the desired name already exists on the
# disk partition. The workaround is to clear the partition labels before the clearpart 
# and part directives run to make them think that the disk has no prior partitions or labels.
#  
# allparts=$( 2>/dev/null sfdisk -d | grep "/dev/"| grep -v "^#" | cut -d ":" -f1 )
allparts=$( sfdisk -d | grep "/dev/"| grep -v "^#" | cut -d ":" -f1 )
for part in $allparts
do
#   Alternate method:  Low-level dd of the 3rd sector of the partition where the label is stored.
#   dd if=/dev/zero of=$part bs=512 count=1 skip=2 
  /usr/sbin/e2label $part " "
done
%end

I don't consider that a "hack" whatsoever and I'm glad you brought that approach up. You cannot use "clearpart" and "--onpart" in the same profile. (which I cannot understand). So - your method would allow you to create the partitions in advance for the --onpart to work. Thanks for that update.

I should point out (if it is not obvious) that the script posted only clears EXT2/3/4 labels. I should think wiping the first 16 or so blocks would cover any LVM configuration information.

e.g.

dd if=/dev/zero of=$part bs=512 count=16

Happy Kickstarting...

Thank you all for your help.