With the power bestowed upon us, we can create a Linux file system in a file. Humanly speaking, we can create a file containing specific file system and mount it as if it were a partition of a hard drive.
To do this, we must first create the file:
Then run the dd command to give a file size:
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:
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.
To do this, we must first create the file:
touch filename
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:
mkfs.ext3 filename
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.
Comments