I know it's an old question but I was looking for information on the structure of the directory and found this.
To get the raw data inside a directory file, you can use debugfs
.
For example:
sudo debugfs /dev/sda1
The you can ls
, cd
, and so on as usual, or cat
a directory.
This isn't very readable so you can use:
dump / dumproot
This creates a file called dumproot
in the location where you invoked debugfs
.
To get the raw content of it you can use xxd
.
For example:
xxd dumproot | head -n2
00000000: 0200 0000 0c00 0102 2e00 0000 0200 0000 ................
00000010: 0c00 0202 2e2e 0000 0b00 0000 1400 0a02 ................
This shows the .
and ..
entries of my /
directory, both have inode number 2, that's the 02000000 at the start. With bigger inode numbers you see them at the start of an entry in little endian.
.
is hex 2e, so that's visible in there as well. I'm not quite sure what "0c00 0102" represents, or how an end of an entry is specified.
That's what I was looking for when i found this thread.