Search code examples
clinuxinode

Is it possible to create an unlinked file on a selected filesystem?


Basically, the same result as creating a temporary file in the desired file system, opening it, and then unlinking it.

Even better, though unlikely, if this could be done without creating an inode that is visible to other processes.


Solution

  • The ability to do so is OS-specific, since the relevant POSIX function calls all result in a link being generated. Linux in particular has allowed, since version 3.11, the use of O_TMPFILE in the flags argument of open(2) in order to create an anonymous file in a given directory.