All right. Here is how to create, format, and mount a container file as a virtual disk.
First create the container file. This one will be 4 GB
Code:
$ dd if=/dev/zero of=test.bin bs=4096 count=1M
1048576+0 records in
1048576+0 records out
4294967296 bytes (4.3 GB) copied, 94.352 s, 45.5 MB/s
Second, attach the container file onto a loop device. This has to be done as root so I use su to log on as root. Once it is attached to a loop device you can create a file system in it using mkfs.
Code:
$ su
# /sbin/losetup /dev/loop0 test.bin
# mkfs -t ext3 /dev/loop0
Those steps only have to be performed once.
Now if you want to mount it do this. Note that you will only have to perform the losetup command if you have detached the container file such as when you restart the computer.
Code:
# /sbin/losetup /dev/loop0 test.bin
# mount -t ext3 /dev/loop0 /mnt/vdisk
Also note that /mnt/vdisk had to already exist.
Now you can use the mount command with no parameters to list all of the mounted devices. Your virtual disk should show up in this list.
Code:
# mount
...
/dev/loop0 on /mnt/vdisk type ext3 (rw)
I hope this helps.