To do this, we must first create the file:
Then run the dd command to give a file size:
dd if=/dev/zero of=/tmp/filename bs=1024 count=102400
In this example a 100 MB file will be created in /tmp. You can modify the parameter “of” to change the location of the new file and parameters “count” and “bs” to change the file size.
Now give it to our file format with the file system you want.
Ext3 For example:
After the file created and formatted, it is now ready to be mounted:
mount -t ext3 /tmp/filename /mnt/filename -o loop
As you may know, the parameter “-o loop” should be used as the file is not a “Block device” or block device.
Clever. We already have our system file nested within the main filesystem.