Not clearing all partitions

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

 



I've been trying to find a 'nice' way to preserve one of my partitions
on installation.  Specifically, this is the Compaq diagnostics partition
on Proliant servers.  I noticed some traffic in the archives for this
list, but the solutions were fairly specific particular hardware.  My
kickstart needs to be across a variety of [Compaq] platforms.

After a bit of mucking about, I've settled on the below as my %pre
script to do what I want.  It works OK, but was wondering if more
experienced souls could comment on how to improve it, or whether what
I'm doing is more damaging than useful.

By way of synopsis, the pre-script clears all partitions off all disks,
regardless of hardware, excepting any diagnostics partitions (unless
they are in an extended part, which they shouldn't be).  It's a pretty
bad kludge, so suggestions welcome.  I'm on RH9.

Thanks in advance

Bryan Tonnet

%pre
# Get a list of drives, and for each one look for an extended partition.
# If one is found, get rid of it first.  If the diagnostics part is
# in the extended part, it will be deleted.  It probably shouldn't be
# there anyway.
for i in `list-harddrives | cut -d' ' -f1` ; do
   for j in `sfdisk -l /dev/$i | grep $i \
             | grep -i ext | cut -d' ' -f1` ; do
      partname=`basename $j`
      partno=`grep "$partname " /proc/partitions | cut -b9-10`
      parted -s /dev/$i rm $partno 1>/dev/null 2>&1
   done
done

# Now do the same again, but remove all parts except any diagnostics. 
# Specifically, we don't want the Compaq diagnostics to be 'vanished'.
for i in `list-harddrives | cut -d' ' -f1` ; do
   for j in `sfdisk -l /dev/$i | grep $i | grep -v Disk \
             | grep -vi disgnostics | cut -d' ' -f1` ; do
      partname=`basename $j`
      partno=`grep "$partname " /proc/partitions | cut -b9-10`
      parted -s /dev/$i rm $partno 1>/dev/null 2>&1
   done
done
**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************




[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux