> De la part ext mai departe pt fiecare part ex o tabela (un 
> sect = 512 bytes)
> 
> Deci cam asa arata
> 
> Tab primara (in MBR):
> 
> Prim1
> Prim2
> Extinsa \/
> Prim3    |
>           >logic1
>           extinsa \/
>                        |
>                         >logic2
> ......
> 
> samd
> 
> 
> asta e un exemplu (la mine asa arata), dar de regula part 
> extinsa din MBR e hda4 (deci pe unde e Prim3 la mine)

Am facut aseara un script mic care citeste tabelele de partitii


<code>

#!/bin/bash

#This script saves the partition table 
#parameter 1 (the only) is the device (/dev/hda)

BS=512
BC=1

if test -z $1;
then 
HDD=/dev/hda
HDNAME="`echo $HDD | tr -d '/' `part"
fi

TEMPFILE=`tempfile`
trap "rm $TEMPFILE"
cfdisk -Pr $HDD | grep "Sector " | cut -d ' ' -f2 | cut -d':' -f1 >$TEMPFILE

NOOFPARTS=`cat $TEMPFILE | wc -l`
CPART=`expr $NOOFPARTS + 1`

#echo aici
echo Saving $NOOFPARTS partition tables...

TIMESTAMP="`date -I | tr -d '-'``date | cut -d ' ' -f4 | tr -d ':'`"
echo Timestamp is $TIMESTAMP
echo

while test $CPART -gt 1; do

        CPART=`expr $CPART - 1`
        SECTNO=`cat $TEMPFILE | tail -n$CPART | head -n1 `
        
        TABLENO=`expr $NOOFPARTS - $CPART`
#       echo tableno=$TABLENO
        
        FILENAME="$HDNAME$TABLENO$TIMESTAMP"


#trebuie scos
#       touch $FILENAME
#       echo cev >>$FILENAME
#dupa finalizare

        echo "Saving table $TABLENO to file $FILENAME"
        echo "Start sector is $SECTNO"
        dd bs=$BS count=$BC skip=$SECTNO if=$HDD of=$FILENAME

        echo

done

DIRNAME=$HDNAME$TIMESTAMP
mkdir $DIRNAME
cp $TEMPFILE $DIRNAME/$HDNAME.$TIMESTAMP

rm $TEMPFILE


mv `ls  | grep -e "$HDNAME[0-9]$TIMESTAMP"` $DIRNAME

tar cfz $DIRNAME.tar.gz $DIRNAME/*
echo $DIRNAME.tar.gz was be created

rm -rf $DIRNAME

</code>



Eddy Petrisor

--- 
Detalii despre listele noastre de mail: http://www.lug.ro/


Raspunde prin e-mail lui