ByteNoise

How to Mount a File in Linux

dd if=/dev/zero of=filesystem.ext4 count=1024 bs=1M
mkfs -t ext4 filesystem.ext4
mkdir /mnt/filesystem
mount -o loop=/dev/loop0 filesystem.ext4 /mnt/filesystem

See Virtual Filesystem: Building A Linux Filesystem From An Ordinary File for details.

Be warned, however, that some things really aren't designed to operate in such virtual filesystems, including databases. Trying out the above can corrupt data, so do so at your own risk, with data you don't need.