Hi, Attached a patch.Only tested with the Ubuntu Precise alternative testing Clonezilla release, and Intel Matrix mainboard RAID.
Yours sincerely, Floris Bos
diff -ur sbin.orig/create-cciss-mapping sbin/create-cciss-mapping --- sbin.orig/create-cciss-mapping 2012-04-20 16:40:19.705255863 +0000 +++ sbin/create-cciss-mapping 2012-04-19 14:18:35.000000000 +0000 @@ -1,10 +1,11 @@ #!/bin/bash # ============================================================================ -# Script to check for /dev/cciss device and remap to /dev/sd<xx> device +# Script to check for /dev/cciss and dmraid devices and remap to /dev/sd<xx> devices # Necessary for Clonezilla to work properly for imaging # # Author: Ron Kelley # Modified by Steven Shiau <steven _at_ nchc org tw> on 25/Aug/2007 +# Modified by Floris Bos on 19/Apr/2011 to support dmraid devices # License: GPL # 2 actions: # (1) link the devices in /dev/ @@ -48,11 +49,6 @@ [ -z "$dev_map" ] && echo "No output file! Exit!" && exit 1 -if [ ! -d "/dev/cciss" -a ! -d "/dev/ida" -a ! -d "/dev/rd" ]; then - echo "No cciss-related driver was detected! Exiting..." - exit 0 -fi - # ------------------------------------------------ # Create an array of all unused /dev/sd<x> devices # ------------------------------------------------ @@ -74,7 +70,14 @@ # clean the output file first echo -n > $dev_map -for cdisk in /dev/cciss/c?d? /dev/ida/c?d? /dev/rd/c?d?; do +dmraid_devices=() +if [ -e /sbin/dmraid ]; then + for volume in $(dmraid -s -c | grep -iv "No RAID disks"); do + dmraid_devices+="/dev/mapper/$volume" + done +fi + +for cdisk in /dev/cciss/c?d? /dev/ida/c?d? /dev/rd/c?d? ${dmraid_devices}; do # If the device is a block device... if [ -b $cdisk ]; then # check if the mapping exists or not. Maybe it's already mapped. @@ -100,7 +103,7 @@ fi # save mapping to the table # remove the leading "/dev/", since in /proc/partitions, the device name is not begin with /dev/, it's only like sda - var="$(echo $cdisk | sed 's|^/dev/||g')" + var="$(readlink -f $cdisk | sed 's|^/dev/||g')" echo "$var:${lnkd_dsk}" >> $dev_map unset var @@ -131,7 +134,7 @@ fi # save mapping to the table # remove the leading "/dev/", since in /proc/partitions, the device name is not begin with /dev/, it's only like sda1 - var="$(echo ${cpart} | sed 's|^/dev/||g')" + var="$(readlink -f ${cpart} | sed 's|^/dev/||g')" echo "$var:${lnkd_dsk}${num}" >> $dev_map unset var fi diff -ur sbin.orig/ocs-functions sbin/ocs-functions --- sbin.orig/ocs-functions 2012-04-20 16:40:19.733255863 +0000 +++ sbin/ocs-functions 2012-04-20 16:42:20.757262445 +0000 @@ -402,10 +402,11 @@ dd if=${img_r} of=/dev/${tgt_dsk} seek=1 bs=512 count=$data_size } # end of restore_hidden_data_after_MBR # -cciss_dev_map_if_necessary() { +raid_dev_map() { # Function to map the cciss dev (/dev/cciss/c0d0p1, /dev/cciss/c0d0p2...) as normal block dev (Ex, /dev/sda, /dev/sdb...) # Provided by Ron Kelley in June/2007 # Modified by Steven Shiau in Aug/2008 + # Modified by Floris Bos on Apr/2012. Now also handles dmraid mainboard RAID devices, and therefore always executes create-cciss-mapping, regardless if a cciss kernel module is found # This is special for Compaq's SMART Array Controllers (Driver for HP Controller SA5xxx SA6xxx), the driver is "cciss" (Ex. /lib/modules/2.6.17-11-generic/kernel/drivers/block/cciss.ko) # Related ref: # http://kbase.redhat.com/faq/FAQ_79_4929.shtm @@ -416,14 +417,6 @@ local cciss_tmp line a b [ -z "$part_tab" ] || [ ! -e "$part_tab" ] && return 1 # Check both kernel module loaded and the dev file - if [ -d /proc/driver/cciss -a -d /dev/cciss ] || \ - [ -d /proc/driver/cpqarray -a -d /dev/ida ] || \ - [ -d /proc/driver/rd -a -d /dev/ra ]; then - echo "Mapping the device list for cciss dev..." - else - [ "$verbose" = "on" ] && echo "No cciss related disk was detected. Skip cciss related actions..." - return 1 - fi cciss_tmp="$(mktemp /tmp/cciss_out.XXXXXX)" # Create the mapping table and link the device name in /dev create-cciss-mapping $cciss_tmp @@ -448,7 +441,7 @@ done < $cciss_tmp # clean the tmp file [ -e "$cciss_tmp" ] && rm -f "$cciss_tmp" -} # end of cciss_dev_map_if_necessary +} # end of raid_dev_map # gen_proc_partitions_map_file() { # partition_table is a global variable @@ -460,7 +453,7 @@ # The devfs is not compiled into kernel, good! # We'd better not use "cp -a /proc/partitions $partition_table", use cat to get the kernel param cat /proc/partitions > $partition_table - cciss_dev_map_if_necessary $partition_table + raid_dev_map $partition_table fi } # end of gen_proc_partitions_map_file # @@ -3390,12 +3383,21 @@ # lrwxrwxrwx 1 root root 0 2008-03-06 11:41 subsystem -> ../../block/ # --w------- 1 root root 4096 2008-03-06 11:41 uevent # + if [ -h "/dev/$p" ]; then + p="$(basename $(readlink -f "/dev/$p"))" + fi x="$(cat /sys/block/$p/device/model 2>/dev/null | sed -r -e "s/[[:space:]]+/ /g" | tr ' ' _ 2>/dev/null)" # the result is like "WDC WD1600JS-60M" # Note! The above method only works in kernel 2.6. For kernel 2.4, it not supported, and it's shown as "No_description" later. x=${x#*\"} x=${x%\"*} - [ -z "$x" ] && x="Unknown_model" + if [ -z "$x" ]; then + if [ -e /sys/class/block/$p/dm ]; then + x="RAID-VOLUME" + else + x="Unknown_model" + fi + fi # parted output Ex. Disk /dev/sda: 160GB // This is only for newer parted. For old parted (1.6.3 in redhat 9, nothing will be shown) # If it's cciss device, since we already made a link in /dev/, so here it won't be a problem. dsize="$(LC_ALL=C parted -s /dev/$p print 2>/dev/null | grep -E "^[[:space:]]*Disk[[:space:]]+/dev/" | awk -F":" '{print $2}' | sed -e "s/ //g")" @@ -5120,31 +5122,14 @@ rm -f $PV_PARSE_CONF $LOGV_PARSE_CONF ocs-lvm2-start echo "Parsing LVM layout..." - LC_ALL=C pvscan | grep -Ew lvm2 | while read LINE; do - DEV="$(LC_ALL=C echo $LINE | tr -s ' ' | cut -d' ' -f2)" - VG="$(LC_ALL=C echo $LINE | tr -s ' ' | cut -d' ' -f4)" - # DEV is like /dev/hda2 - # We just want to keep the chosen target - # The results in $PV_PARSE_CONF is like: - # ---------------------------------------------------- - # vg /dev/hda2 qdlt6U-M4bo-xExy-XG9Q-U7pg-bOXN-n54i5Y - # ---------------------------------------------------- - # Ex: target: hda1 hda2 hda3, DEV maybe: /dev/hda2 - # If the device is CCISS RAID, we have to follow the file links since they - # are linkded by create-cciss-mapping - # Therefore here we use stat to get the real device name - # Before we use: if [ -n "$(echo "$target" | grep -E "\<${DEV##*/}\>")" ]; then - FND_PV="no" - for i in $target; do - if [ -n "$(LC_ALL=C stat --printf="%N\n" /dev/$i | awk -F" " '{print $NF}' | sed -r -e "s|\`||g" -e "s|'||g" | grep -Ew "${DEV##*/}")" ]; then - FND_PV="yes" - break - fi - done - if [ "$FND_PV" = "yes" ]; then - UUID="$(LC_ALL=C pvdisplay $DEV | grep "PV UUID" | awk -F" " '{print $3}')" - echo "$VG $DEV $UUID" | tee -a $PV_PARSE_CONF - fi + # We just want to keep the chosen target + # The results in $PV_PARSE_CONF is like: + # ---------------------------------------------------- + # vg /dev/hda2 qdlt6U-M4bo-xExy-XG9Q-U7pg-bOXN-n54i5Y + # ---------------------------------------------------- + # Ex: target: hda1 hda2 hda3 + for i in $target; do + LC_ALL=C pvs --noheadings --separator " " -o vg_name,pv_name,pv_uuid /dev/${i}* 2>/dev/null |sed -e 's/ //' >> $PV_PARSE_CONF done if [ ! -e "$PV_PARSE_CONF" ]; then
------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________ Clonezilla-live mailing list Clonezilla-live@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/clonezilla-live