How safely partition disks in a multipath environment? (setup-storage)

Peter Bittner peter.bittner at thalesgroup.com
Fri Sep 10 17:49:15 CEST 2010


Great, I kind of made it. Not easy to find out how to check what paths
are not accessible (i.e. which disks get a read error when setup-storage
goes over them.

> I think the most promising way would be a hook that modifies the contents of the
> "disklist" variable. By default, its contents is determined by reading
> /proc/partitions in FAI's disk-info script. If you add a hook
> partition.DEFAULT.source that changes $disklist in an appropriate way I guess
> you should readily get some reliable results. 

For everyone interested, here is my solution:

I created a hook named "partition.FAICLASS.source" (where FAICLASS is
the class that you want this hook to be executed for), file attributes
755 (chmod 755 partition.FAICLASS.source), and the following content:

#! /bin/bash
# remove non-accessible disks (i.e. non-active paths in multipath
# environment) from disklist
for disk in $disklist; do
    echo -n -e "\rTesting /dev/$disk for read access ..."
    if [[ $(hdparm -t /dev/$disk 2>&1 | grep error) != '' ]]; then
        echo -e "\nDevice '$disk' not accessible. Expunging from
disklist."
        disklist=${disklist/$disk/}
    fi
done
echo -e "\rAccessible block devices (disks): $disklist    "

I'll see whether that helps already or if I need to sort the remaining
disks by some criteria (e.g. size).

Thanks for the hints!
Peter


More information about the linux-fai mailing list