HP Insight Control server provisioning Capturing and Installing Linux System Images

6
Intelligent Provisioning Environment and the PXE booted LinuxPE will automatically attempt to mount the server’s
image.
To create a new script to unmount the disk partitions:
1. On the IC server provisioning appliance, create a new script of Unix type and name it for the appropriate
function.
2. Create the script content or copy and paste the script content from an external application. For example, the
script would contain:
#!/bin/bash
#
# Unmount all disk mounts so that we can work on the disks
#
echo "Unmounting hard disk partitions..."
MNTS=`awk '{print $2}' < /etc/mtab | sort -r`
for MNT in $MNTS
do
if echo $MNT | grep -qE \
'((sd|hd)[a-z]{1,2}[1-9]+|cciss/c[0-9]d[0-9])'
then
umount $MNT
fi
if echo $MNT | grep -qE \
'^/mnt/(mapper|local_root|by-uuid|by-label)'
then
umount $MNT
fi
done
3. Click OK to save the script.
Remove Old Partitions Script
Create a new script that fixes the disk in preparation for writing a new partition table. The sample script provided only
deals with LVM2 volumes and groups. It won’t handle disks that have more complicated setups.
To create a new script to fix the disk in preparation for writing a new partition table:
1. On the IC server provisioning appliance, create a new script of Unix type and name it for the appropriate
function.
2. Create the script content or copy and paste the script content from an external application. For example, the
script would contain:
#!/bin/bash
echo "Removing Logical Volumes..."
LVS=`lvs | grep -v "Data%" | awk '{print "/dev/" $2 "/" $1}'`
for LV in $LVS
do
lvremove -f $LV
done
echo "Removing Volume Groups..."
VGS=`lvs | grep -v "Data%" | awk '{print $2}' | sort -u`
for VG in $VGS
do
vgchange -a n $VG
vgremove f $VG
done
# wipe MBR and partition table.
dd if=/dev/zero of=/dev/sda bs=512 count=1