How to correctly create a virtual file system?

A task in my homework assignment asks me to create a virtual file system, mount it, and perform some operations on it.

I am supposed to create a file of 10 MB whose bits are all set to 0, format it as ext3 and mount it. This is how I've done that:

dd if=/dev/zero of=~/filesyst bs=10485760 count=1
sudo mkfs.ext3 ~/filesyst
sudo mount –o loop ~/filesyst /media/fuse

Even though I've used /dev/zero, the file i still full of gibberish characters (mostly at-signs). The permissions on /media/fuse are drw-rw-rw- (which are alright), but the permissions on the files inside it are something like this:

d????????? ? ? ? ?          ? lost+found
-????????? ? ? ? ?          ? secret_bin

Where have I gone wrong?


Solution 1:

Hmmm... the correct way to do it is:

dd if=/dev/zero of=./filesyst bs=10485760 count=1
sudo losetup /dev/loop0 ./filesyst
sudo mkfs.ext3 /dev/loop0
sudo mount /dev/loop0 /tmp/lalla

and it works:

(0)romano-asus:~/tmp% ls -l /tmp/lalla
total 12
drwx------ 2 root root 12288 2011-12-20 22:21 lost+found
(0)romano-asus:~/tmp% df /tmp/lalla
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/loop0                9911      1121      8278  12% /tmp/lalla

You should check the first loop device free with losetup -f.