b g wrote:

On Tuesday 18 November 2003 17:49, Oron Peled wrote:
Sorry for the lame question, but what are magic numbers? Before working on the raw device, I though it would be a good idea to know what I'm doing. Googling for ["magic numbers" ext3 fdisk] leads to zillions mailing list archives, so if anyone can point me to a resource which has more or less comprehensive explanations, I'll be glad to hear.
What I uderstand from Oron's answer is that some number marks the start and the end of a prartition, so by knowing in which blocks they appear, one can reconstruct the partition table. Am I correct?


Magic numbers are used to identify the type of filesystem the super block is contained.
All EXE files in DOS and derivatives begin with "MZ" (Mark Z-something was a leader programmer for MS back then), etc.
EXT3's super magic is 0xEF53 (see include/linux/ext3_fs.h).


I had similar problem (partition table mess) a long time ago (~8 years):


<snip>


Ignored numbers which where not in regular intervals
(false alarms)



what intervals can be considered as "regular"




AFAIK, those regular intervals should be N*2^M, where M is a natural number ~ 13, and N is a small natural number. ext2's interval was very early hardcoded as 8192, I'm not sure how it's done nowadays.

If you see 4 super block candidates whose block numbers form an algebraic series, 99.9% that's the right block. You can verify against the rest of the blocks....

         3. Ran 'fsck -b <super_block_number>'
         4. If all is good (it was in my case), than we can trust the
            superblock data (start and size of partition)
         5. So we can safely use them to fix the partition table
            (back then I used Norton-Disk-Doctor under DOS to edit
            the partition table. I think today parted would give
            you better options -- but didn't check it).

Hope it helps,




===============================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

.



Shachar.



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Reply via email to