Partition detection and recovery
FWIW, one can find in util-linux a program called `rescuept' for recovering
a corrupt partition table. The program has been written by Andries Brouwer,
and one of its main interests is that statically compiled against uClibc
this is only a 16308 bytes executable.
rescuept stands for rescueing Partition Table. It might of some interest for
others. You will also find attached an example script that uses the
/proc/partitions to create the device files and then call `rescuept'.
Cheers,
--
Thierry LARONDE, Centre de Ressources Informatiques, Archamps - France
http://www.cri74.org/
#!/bin/sh
# viewpart : display partitionning informations
# C) 2001 Thierry Laronde <thierry@cri74.org>
# C) 2001 Centre de Ressources Informatiques de Haute-Savoie
# Put under GPL
file="/proc/partitions"
owners="root:disk"
disks=`sed -n '1,2!s/^.*[[:space:]]\+\([a-z]\+\)$/\1/p' $file`
echo "Found mass storage devices : "$disks
echo "Creation of device special files"
devices=`sed -n '1,2!s%^[[:space:]]*\([0-9]\+\)[[:space:]]\+\([0-9]\+\)[[:space:]]\+.*[[:space:]]\+\([a-z].*\)$%\3:\1:\2%p' $file`
for device in $devices; do
devname=`echo $device | cut -d ':' -f 1`
major=`echo $device | cut -d ':' -f 2`
minor=`echo $device | cut -d ':' -f 3`
mknod /dev/$devname b $major $minor
chown $owners /dev/$devname
chmod 660 /dev/$devname
done
echo "Reading partitionning informations (for recovery)"
echo
for disk in $disks; do
rescuept /dev/$disk
done
exit 0
Reply to: