Re: Have to wipe LVM after repeated reinstall

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Maybe not too helpful but I have seen this problem as well (although my
%pre script is not nearly as fancy ;-).

Greg

On Tue, 2007-01-09 at 20:41 -0500, Christopher Boumenot wrote:
> Greetings,
> 
> I have been noticing a problem with anaconda when repeatedly installing 
> a server with a disk configuration involving LVM.  Anaconda will fail 
> because it cannot create the volume group VolumeGroup00.  After looking 
> at the disk, it is clear why - the volume group still exists.  To get 
> around this I wrote a simple %pre script that destroys all PGs, VGs, and 
> LVs it knows about.  A copy of that script may be found at the bottom of 
> this email.  Is this the correct solution, or should Anaconda be 
> handling this?  I have verified this behavior on RHEL 4u2, and CentOS 4u4.
> 
> ---> kickstart.cfg <----
> install
> text
> url --url http://192.168.1.88/centos/4.4-i386
> skipx
> mouse none
> #reboot
> authconfig --enablemd5 --enableshadow
> lang en_US.UTF-8
> langsupport --default en_USs.UTF-8 en_US.UTF-8
> keyboard us
> firewall --disabled
> selinux --disabled
> bootloader --location=mbr
> timezone --utc US/Eastern
> network --device eth0 --bootproto dhcp
> clearpart --all --initlabel
> partition pv.00 --size 1 --grow
> volgroup VolumeGroup00 pv.00
> logvol /    --vgname VolumeGroup00 --size 4000  --name=root.fs
> logvol swap --vgname VolumeGroup00 --size 2048  --name=swap.fs
> logvol /var --vgname VolumeGroup00 --size 8192  --name=var.fs
> logvol /usr --vgname VolumeGroup00 --size 4096  --name=usr.fs
> logvol /opt --vgname VolumeGroup00 --size 16384 --name=opt.fs
> 
> %packages --resolvedeps
> @Web Server
> 
> 
> # Destroy anything related to LVM
> %pre --interpreter /usr/bin/python
> import os, re, sys
> 
> lvm = "/usr/sbin/lvm.static"
> 
> fouth = open("/tmp/lvm_wipe.log", 'w')
> print >>fouth, "Starting LVM wipe ..."
> 
> if not os.path.exists(lvm):
>      print >>fouth, "Error: cannot find %s" % lvm
>      sys.exit(1)
> 
> 
> for lv in (os.popen("%s lvscan" % lvm).readlines()):
>      m = re.match(r".*'([^']+)'", lv)
>      if m:
>          cmd = "%s lvremove %s" % (lvm, m.group(1))
>          print >>fouth, cmd
>          print >>fouth, os.popen(cmd).read()
> 
> for vg in (os.popen("%s vgscan" % lvm).readlines()):
>      m = re.match(r'\s*Found volume group "([^"]+)"', vg)
>      if m:
>          cmd = "%s vgremove %s" % (lvm, m.group(1))
>          print >>fouth, cmd
>          print >>fouth, os.popen(cmd).read()
> 
> 
> for pv in (os.popen("%s pvscan" % lvm).readlines()):
>      m = re.match(r'\s+PV (\S+)', pv)
>      if m:
>          cmd = "%s pvremove %s" % (lvm, m.group(1))
>          print >>fouth, cmd
>          print >>fouth, os.popen(cmd).read()
> 
> fouth.close()
> 
> 
> Thanks,
> Christopher
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
-- 
Greg Dickie
just a guy
Maximum Throughput


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux