230 The Virtualization Cookbook for Red Hat Enterprise Linux 5.2
fi
done
# Expand DASD ranges if they have been defined
if [ -n "$DASD" ] ; then
split=$(echo $DASD | tr ',' ' ')
DASD=""
for s in $split
do
out=$(echo $s | grep \-)
rc=$?
[ $rc -eq 0 ] && DASD=${DASD}$(seq -s" " $(echo $s | tr '-' ' ' | tr '\n' ' '))
[ $rc -ne 0 ] && DASD=${DASD}$(echo -n "$s ")
done
[ -n "$DASD_ROOT" ] && DASD=$(echo $DASD | sed "s/$DASD_ROOT//")
DASD="$DASD_ROOT $DASD"
# Assuming that if no DASD_ROOT is specified then the first DASD device will be
# take as root
if [ -z "$DASD_ROOT" ] ; then
DASD_ROOT=$(echo $DASD | awk -F" " '{print $1}')
fi
export DASD
fi
# Grab just the hostname with out any DNS suffixes from the FQDN
target_host=$(echo $target_fqhost | awk -F. '{print $1}')
}
#+--------------------------------------------------------------------------+
function dd_copy
# Use the dd command to copy one disk to another
# Arg 1: Source minidisk - assumed to be online
# Arg 2: Target minidisk - must be brought online and dasdfmt'd
#+--------------------------------------------------------------------------+
{
ret_val=0
source_mdisk=$1
target_mdisk=$2
# Bring the source and target devices online
set_online $source_mdisk
set_online $target_mdisk
target_dev_node=`cat /proc/dasd/devices | grep "$target_mdisk(ECKD)" | awk '{ print $7
}'`
source_dev_node=`cat /proc/dasd/devices | grep "$source_mdisk(ECKD)" | awk '{ print $7
}'`
wait_for_device /dev/$target_dev_node
[ -n "$VERBOSE" ] && echo "Invoking Linux command: dasdfmt -p -b 4096 -y -f
/dev/$target_dev_node"
[ -n "$VERBOSE" ] && progress="-p"
dasdfmt $progress -b 4096 -y -f /dev/$target_dev_node
[ $? -ne 0 ] && echo "Error: dasdfmt failed" && ret_val=1
wait_for_device /dev/$source_dev_node
Comentarios a estos manuales