I would like to create a special file similar to
/dev/random, where the file doesn't actually exist but you can read from it all the same, except that I could actually set a cap on the apparent size of the file.
To put it another way, I want to create a special file where (assuming I set the cap at 500GB) when I "cat" the file it will output all 500GB of the file and then stop. It needs to act the same as an actual 500GB file, but without taking the space. The contents of this file don't matter, it could be all
/dev/null, or just a small string being sent over and over, or whatever.
Is this something that's do-able? The only thing remotely close I've been able to find is man pages talking about
mknod, but those weren't very helpful.