haveaniceday
Hacker
von hier: http://www.linux-club.de/ftopic79797.html
Falls mal jemand den passenden Loop-Mount-Befehl für ein Festplattenimage bekommen möchte.
Es heisst hier zwar "Security & Backup" aber ich schätze "Restore" passt auch mit rein ;-)
Haveaniceday
Falls mal jemand den passenden Loop-Mount-Befehl für ein Festplattenimage bekommen möchte.
Es heisst hier zwar "Security & Backup" aber ich schätze "Restore" passt auch mit rein ;-)
Haveaniceday
Code:
#!/bin/bash
# fdisk finden
PATH="/sbin:$PATH"
if [ $# -lt 1 ]
then
echo "usage: ${0##*/} <image>"
exit 1
fi
IMAGE=$1
if [ ! -f $IMAGE ]
then
echo "Warnung, $IMAGE ist kein File"
fi
# tr -d '*' => bootflag entfernen
LANG=C fdisk -lu $IMAGE 2>&1 | tr -d '*' | grep "$IMAGE[0-9]" | while read part start end blocks id rest
do
echo
echo "$read $part $start $end $blocks $id $rest"
case $id in
f) echo "Ignoriere extended partition"
continue
;;
82) echo "Ignoriere Swap"
continue
;;
*)
;;
esac
let offset=$start*512
echo mount -o loop,ro,offset=$offset $IMAGE /mnt
done
exit 0