Quote:
Originally Posted by syg00
Not that I'm aware of - the code in the MBR only has relative sector number in it, not partition-id. You could eye-ball it and do the math yourself, but ...
|
Well, I found out from another forum a solution to my question, and it is a true gem of pure linux voodoo:
Code:
sudo dd if=/dev/sda bs=1 skip=1049 count=2 | hexdump
This command reads the necessary info from your boot drive's MBR. Of course replace /dev/sda with your boot drive if it is different. The output will look something like:
Code:
2+0 records in
2+0 records out
2 bytes (2 B) copied, 0.0177551 s, 0.1 kB/s
0000000 ff04
0000002
The critical piece of info is the "FF04". "FF04" that means (hd0,4) because FF means the controlling linux partition is on the boot drive, and the 04 is the fifth partition. "FF02" is (hd0,2) or the third partition on the boot drive, "FF03" is fourth partition, etc.
If the controlling linux partition is on a HD other than the boot drive, the first two numbers XY in the four-digit hex sequence will correspond to (hdY,X), instead of being "FF". Thus if get "3103" that means (hd1,3) or 2nd HD, 4th partition. Or "5105" means (hd1,5) or 2nd HD, 6th partition.