Re: Changing file mounted as loop device

From: peter pilsl (pilsl_at_goldfisch.at)
Date: 05/26/04


Date: Wed, 26 May 2004 16:26:19 +0200

Anthony Starovoytov wrote:
> 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.
>

you mount the file x.iso on mountpoint /mnt/x and then start changing
the file x.iso ? I dont think there is any prediction what will happen.
If it doesnt mess up everything then probably because of some caches and
cause the beginning of a filesystems might contain all the
allocation-tables in several copies that are restored if the filesystem
detects inconsistencies (but I'm not an expert to filesystems, but the
old dos-system had two copies of its FAT stored as far as I can remember
... )

however: your method is far from being secure. you need a trick to
protect your data and as soon as the trick is revealed it doesnt work
any more.

a simple plaintext-search through the file will reveal most of the data
you try to hide. And you add overhead doing so as well.

I think a simple encryption would be much more secure, relieable and not
slower than your approach.

best,
peter