What is the magic number for a Berkeley DB v9 Btree with a native byte order? Is there any specific length on magic numbers or any easy way to identify them?
As you've found it's 0x00053162
. I'm assuming by native byte order, you mean x86 native byte order? If you hexdump the file, you'll see it in bytes 12-15, byteswapped (as 3162 0005, because it's x86):
hexdump blah.db | head -1
0000000 0001 0000 9fbc 0009 0000 0000 3162 0005
0000010 0009 0000 1000 0000 0900 0001 0000 0000
The version is in the next uint32_t
, bytes 16-19. Here, it's 0009 0000
, which is version 9 in little endian-speak. In fact, that whole sequence of bytes starting at offset 12 looks to be a struct __db_bt_stat
, the content of which is given in the manpage for db_stat
(or Db::stat
) available here: http://www.mit.edu/afs.new/athena/astaff/source/src-9.0/third/db/docs/api_cxx/Db/stat.html