I called this script “readpartition” but you can call it anything you choose. The purpose of this script was to fill in a missing piece of the HP-UX 11.31 Itanium root disk mirroring procedure. The output of this script is designed to be the input partition description file for idisk.
#!/usr/bin/sh
################################
# Read the Partition Table HPUX 11.31 Itanium
# and make an input file suitable for idisk
################################
if [ $# -eq 1 ]
then
/usr/sbin/idisk -p $1 | awk
‘/Primary Partition Table/ { ByteBlocks = $5 }
/Partition [1-9]/ { FS = “[():]”
$1 = substr($1,15,1) + 0
A = $1;
Partition[A]=$2
getline; getline; getline;
# print $0
$0=substr($0,31);
# printf (“%d, %xn”, $0, $0) # Check to see if Hex is read correctly
First[A] = $0 + 0;
if ( Partition[A] == “EFI” )
{ First[A] = First[A] – 64;
}
getline; getline;
# print $0
$0=substr($0,31);
# printf (“%d, %xn”, $0, $0) # Check to see if Hex is read correctly
Last[A] = $0 + 0
Size[A] = ( Last[A] – First[A] + 1 ) / 2048;
}
END { print A
for (i = 1; i <= A; i++)
printf(“%s %dMBn”, Partition[i], Size[i])
}’
if [ $? -eq 0 ]
then
return;
else
echo “Usage $0 <raw device>n”
fi
fi
To invoke it:
# ./readpartition /dev/rdisk/disk5
3
EFI 500MB
HP-UX 139114MB
HPSP 400MB
If the size of a partition is specified as 100% then all space remaining is assigned to that partition.
3
EFI 500MB
HP-UX 100%
HPSP 400MB
– See more at: http://serviceitdirect.com/blog/script-reading-hp-ux-itanium-root-disk-efi-partitions#sthash.vxqu6V87.dpuf