Quantcast
Channel: Admins Goodies » mbr
Viewing all articles
Browse latest Browse all 10

How to calculate the starting address of a partition from MBR

$
0
0

Question

Given a MBR and the structure of MBR/partition table, how can you calculate the size and starting address of each partition?

For clarification let’s say I was given this-

enter image description here

Answer: There are three partition table entries shown in the MBR.

Partition 1: Starting LBA Address: Sector 63 (decimal). If using hex
representation, the starting address is 0000003f. Size: 20482812
Sectors (decimal). If using hex representation, the size is 01388afc.

Partition 2: Starting LBA Address: Sector 20482875 (decimal). If
using hex representation, the starting address is 01388b3b. Size:
20482875 Sectors (decimal). If using hex representation, the size is
01388b3b.

Partition 3: Starting LBA Address: Sector 40965750 (decimal). If using
hex representation, the starting address is 02711676. Size: 37142280
Sectors (decimal). If using hex representation, the size is 0236bf08.

How do you get to that answer?

Answer

Depends on the OS, system, and file-system format.

Wikipedia is a good resource on the subject: http://en.wikipedia.org/wiki/Master_boot_record

Start following the layout. The partition table entries start at 000001BE … with the 16-byte partition record…

skipping the not-so-important bits…

the 1st partition is NTFS (000001C3) and starts at 0000003f (look at the 4 bytes in little-endian starting at 000001c6) and the size is 01388acf (look at the 4 bytes in little-endian format starting at 00001ca)

If you can’t read the wikipedia page & understand it… you probably shouldn’t be doing this… or should have studied better in class.


Viewing all articles
Browse latest Browse all 10

Trending Articles