views:

168

answers:

3

Hi,

Following my question about creating files.
After fast creation of large file, now i need to create a file system on this file. How can i create something like Loop device on Linux. After this i guess formatting will be really easy. Any alternative method (instead mounting) for formatting file to different FAT (12/32) and ext3 are welcomed :)

I would prefer to do it in C/C++, but in the worst case i can use external commands i.e running ready executable from my application.

Edit:
It seems like Windows does not allow this natively, so it will be best to find some application that doing exactly this i.e mounting file as a files system. Otherwise i have a problem with open source licenses.

+3  A: 

Take a look at TrueCrypt's source code. It is a open-source disk encryption software for Windows Vista/XP, Mac OS X, and Linux. It can create a virtual encrypted disk within a file and mounts it as a real disk.

Therefore its source code must contain "create a file system on this file" part.

J.F. Sebastian
For example, try `ack FormatFat` at the source tree root.
J.F. Sebastian
Thanks, looks promising i will check it out.
Ilya
A: 

It's not really an answer, but might be related enough for you to be interesting:

Windows 7 should be able to boot from a VHD (virtual hard disk) so if you look for a Windows-Like approach to this problem, this might lead you in the right direction.

Joachim Sauer
Thanks for pointer, but can't wait so long :)
Ilya
But it seems like Windows 7 going to right direction :)
Ilya
A: 

Eldos make a component, Solid File System that might do what you're looking for

Conrad
no it's not i don't need new file system, i need ability to create one using file instead of disk. It's really easy on linux using mount -o loop ...
Ilya