Search code examples
cstorageinode

Can you directly modify the indirect blocks of an inode in user space?


Is there a way in user space to directly modify the indirect block pointers in an inode?

I was reading this paper http://www.cis.syr.edu/~wedu/seed/Documentation/Minix3/Inode.pdf but what I gathered from it, like it's title says, it's manipulating inodes, not explicitly modify blocks within the inode.

I realize this sounds like a terrible thing to do, I do not have any intention of doing something like this for production use, this is just for my own knowledge.


Solution

  • Some filesystems(ext*fs, not sure about minix) optimize and write data(<60 bytes) into the block pointer array of the inode.

    In that case you can just modify last 12 bytes which are corresponding to indirect block pointers.

    You cannot access the block pointer array in user space; however, you can do the hack of just create a file of 60bytes and then try to read its content.