[Mono-dev] File System-like storage

Brian Crowell mono-devel at fluggo.com
Thu Aug 31 13:25:50 EDT 2006


pablosantosluac wrote:
> would be great! but I wonder if it will work on windows... ;-)

Not in the least!  :P  But lightweight read-write filesystems that can be used 
inside another program are in short supply. You might as well just use the 
actual filesystem.

Besides, I just checked, and only root can do this. But it's one of the neatest 
things I've learned about Linux so far, so I'll share it anyhow.

Create an empty file where your "partition" will reside:

   # dd if=/dev/zero of=my.fs bs=1M count={count}

...where {count} is the number of MB in the filesystem.

Then create the filesystem. mke2fs will do it straight on the file; if others 
refuse, research losetup.

   # mke2fs my.fs
   mke2fs 1.38 (30-Jun-2005)
   my.fs is not a block special device.
   Proceed anyway? (y,n) y
   ...

Mount your filesystem using a loop device.

   # mkdir my.fs.dir
   # mount -o loop my.fs my.fs.dir

When you're done, unmount it.

   # umount my.fs.dir

Feel free to compress the resulting file. It will give worse results than just 
doing tar/gz, though.

--Brian



More information about the Mono-devel-list mailing list