I have the following problem: due to the security reasons I'd like to
make a partition unreadable for other persons even if they will switch
off the power, take my hard disk and install on their workplace. I did
not want to use crypto apis cause they could be slow. My idea was to
create a file, bind it to the loop device, mount and then change first
X bytes with the random data. And replace them with the correct ones
before mounting and umounting and then change back to random.

I got the stange (but probably correct) behaviour: if I change the
file after mounting, all the changes could be discarded under unknown
rules - they could be new random now and when I view the file in 1
second, it contains the old correct data.

So it stores somewhere the correct beginning?
My question is: how I can reach my goal, probably using other ways.
But it would be also very interesting why it behaves so and where I
can read what actually is done when mounting files using loop devices
and why it restores them.