It is very easy to create a loopback filesystem in your home directory. This can be used to store files, or can be enabled as a swap partition.
Firstly, run this command to create a blank file-system image. This will be 524 megabytes.
jason@Yog-Sothoth:~/Documents$ dd if=/dev/zero of=myimage.img bs=1024 count=524288 |
Now we can create a filesystem on it and make it usable.
jason@Yog-Sothoth:~/Documents$ sudo mkfs.ext4 myimage.img [sudo] password for jason: mke2fs 1.43.5 (04-Aug-2017) Discarding device blocks: done Creating filesystem with 131072 4k blocks and 32768 inodes Filesystem UUID: e7173517-d589-43df-a76a-31374f3377f4 Superblock backups stored on blocks: 32768, 98304 Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done |
This file-system is ready to be used, just mount it to a directory and then create a directory on the file-system that is owned by your user and you will be able to copy files to it and use it as just another directory on your system.
jason@Yog-Sothoth:/mnt/image$ sudo mount myimage.img /mnt/image/ |
This is a very useful Linux trick, it could be used for many things, but I think many of you will like to give this a try.