Hi,

just a follow-up to my posting last night.

I tried Mathieu Alorent's patch for setup-storage/Command.pm, but
it resulted in a similar "Cannot satisfy pre-depends" error.

As a workaround, in order to be able to re-install a system with MD RAID and LVM, I wrote a small hook script named partition.WIPEDISKS (see attachment) in which I basically destroy the LVM, MD RAID setups and
wipe the boot sector of the hard drives.

Using this script I am able to reinstall such a system.  However,
the price is that I cannot preserve any partition, ie all the nice
preserve_xxx=device  options won't work.  For an LVM based parition setup
I'd expect the system to re-format all partitions which are not marked
to be preserved when task_partition (setup-storage) is run while those
marked to be preserved are left untouched. This would be useful for doing a clean reinstallation of the system while data partitions are preserved.
Would be great if this behaviour could be available for this use case
(MD RAID+LVM) as well.

Thanks,

w.w.
#!/bin/bash
#
# hooks/partition.WIPEDISKS
#
# author : W. Walkowiak, 2013-01-03
# changed: 
#
# Stop LVM an MD RAIDs if existing and wipe all disks with wipefs and dd
#
# $Id: $
#===========================================================================

error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code

#--- functions

#----

# stop volume groups
echo "Stopping VGs:"
vgs 
vgchange -an $vg

# stop MD RAID arrays
echo "Stopping and removing MD RAID arrays:"
mdadm --detail --scan 
for array in $(mdadm --detail --scan | cut -d ' ' -f 2 | xargs readlink -f )
do
  parts=$(mdadm --detail  $array | grep '/dev/' | grep -oE "[^ :]+$")
  mdadm --stop $array
  [ -x $array ] && mdadm --remove $array
  for part in $parts; do
    echo "zeroing $part"
    mdadm --zero-superblock $part
  done 
done
rm -f /etc/mdadm/mdadm.conf

# wipe all disks with wipefs and dd
if [ -n "$disklist" ]; then
  echo "Wiping boot sector of disks: $disklist"
  for disk in $disklist; do
    wipefs -a /dev/$disk
    dd if=/dev/zero of=/dev/$disk bs=512 count=1
  done
fi

exit $error

Reply via email to