I wanted to play around with virtual filesystems and I also was working on huge tar files at that time. Untaring some file just to copy out all of it content (more tar files) and then cleaning up was a bit PITA, so I decided to see if I can write a virtual filesystem that will show the insides of the tar file without wasting space.
I decided to do this using FUSE and I only cared about extracting data so the filesystem is read-only.
The script is here. It is using the llfuse python module.
It was a very nice way to understand a bit better how filesystems in *NIX environments work.
Usage for the script is straight forward:
$ ./fuse_tar.py -h
usage: fuse_tar.py [-h] [--mountpoint MOUNTPOINT] [--debug] [--debug-fuse]
tarfile tarfile to mount
-h, --help show this help message and exit
Where to mount the file system
--debug Enable debugging output
--debug-fuse Enable FUSE debugging output
By default it can handle tar, tgz, tar.bz2 and tar.xz. Obviously access times will differ between the different formats. If the mount point is not specified it tries to create a folder in a current working directory with the name of file but without the suffix.