Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In linux, given an offset into a raw disk device, is it possible to map back to an partition + inode?

For example, suppose I know that string "xyz" is contained at byte offset 1000000 on /dev/sda: (e.g. xxd -l 100 -s 1000000 /dev/sda shows a dump that begins with "xyz")

1) How do I figure out which partition (if any) offset 1000000 is located in?(I imagine this is easy, but am including it for completeness)

2) Assuming the offset is located in a partition, how do I go about finding which inode it belongs to (or determine that it is part of free space) ? Presumably this is filesystem specific, in which case does any one know how to do this for ext4 and ext3?

share|improve this question
1  
It is definitely possible and a few years ago I saw the HOWTO somewhere in the internet. The trick involves some math on different parameters of the filesystem and partition table. Try to search for it. This could be useful: unix.stackexchange.com/questions/37119/… – Serge Oct 21 '12 at 22:13

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.