filesystems – how is a file represented on a disk – Education Career Blog

so I want to ask, and forgive me if this is obvious, or newbie question:
if I create a file, say a text file – save it, (I’m using Ubuntu), so this file I have created, has some extra information associated with it, such as, the place on my hard drive where it has been saved. How to examine this information? Where does this information get stored for my specific file? How to examine the file as it is stored on my disk, I assume in terms of, what, bytes?

Maybe I need to focus this question,




This is the responsibility of your file system. In very brief, a file system is a data structure which is laid out onto your entire disk — that’s what “formatting” a disk does — and your files are saved into that data structure. There are lots of file systems, and their details vary quite widely. has a whole bunch of papers on file system design and organization. I’d start with McKusick’s A Fast File System for UNIX; it’s old, but it contains lots of ideas that are still influential today.

You need a filesystem-specific forensics tool if you want to look at the data structures on your disks. Ubuntu’s probably using something in the ext2 family, so try debugfs.


I think maybe you do need to focus it a bit 🙂

For UNIX file systems, there are many different types.

The one I’m most familiar with (ext2) has a “file” on disk containing directory entries. These entries are simple names and pointers to the file itself (which is why you can have multiple directory entries pointing to the same file, hard links).

The file itself is an inode which contains the properties of the file (owner, size, permissions and so on).

The inode also contains direct and indirect pointers to the contents of the file. By direct, I mean a pointer to a data block.

An indirect pointer is a pointer to a pointer to contents. I believe you can go to another two levels of indirection, which gives you truly massive file sizes:

alt text

More details on Wikipedia.

Leave a Comment