We are used to create filesystem when we install a new operational system. However, linux provide a way to create a filesystem to file. Between many benefits, we can save confidential data.
To do that, is simple and easy. Open a shell and type:
dd if=/dev/zero of=~/partitionfile bs=1024 count=100000
This will create a file named partitionfile of 100MB with blocksize of 1024B. Now format the partition:
mkreiserfs -f ~/partitionfile
A message will be emitted informing that, this file, is not a block special device. Press y and after enter to continue. how you can realize, I formatted with reiserfs filesystem, but you can format using other type. However reiserfs filesystem requires a minimum size of 32MB.
Everything ok, we just need to mount this file. Still in the shell, type:
sudo mount ~/partitionfile /mnt -t reiserfs -o loop=/dev/loop1
In this case, the option -o loop will use kernel resource to mount the file. How I formatted the partition with reiserfs I specified the type in option -t. If you used another, specify the right partition type.
With that, you have a new partition to be used. You can inside it, create file, copy file, etc…
To check it, type in the shell:
That’s it folks. See you next time.