From daf0fef2b9193c4016826818eef76ceb05fcc3b0 Mon Sep 17 00:00:00 2001 From: haxala1r Date: Thu, 27 Nov 2025 18:05:46 +0300 Subject: [PATCH] Added README.md --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3540fda --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# Tar FUSE + +This program mounts a tar file system to a directory through FUSE. + +Have you ever wanted to have a nice, convenient view into a tar file without +having to unpack it, and without having to learn a ton of obscure tar commands? +Have you ever wanted to be able to do `find -type f -name "*.ml"`, or any other +search command, only inside a tar file? + +If you've experienced any of the above, this is your lucky day! Just mount the +tar file to a directory: + +```sh +$ fusetar my-archive.tar mnt/ +``` + +And just like that, everything inside the tarball is available to you as a +read-only file system, to search, read or do whatever else. + +An example with the debian rootfs: + +```sh +$ wget https://github.com/kbaraniak/debian-rootfs/releases/download/bookworm-270224/debian-amd64-bookworm-rootfs-270224.tar.xz +... +$ xz -d debian-amd64-bookworm-rootfs-270224.tar.xz +$ mkdir -p mnt +$ fusetar debian-amd64-bookworm-rootfs-270224.tar mnt/ +$ ls debian-amd64-bookworm-rootfs-270224.tar.xz +bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var +``` + +As you can see, the root file system inside the tar archive is transparently presented to you now under your mounted directory! + +Note that it is read-only. Tar is a streaming format, and it is quite awkward to try to make changes/additions to it. + +With that being said, if you absolutely need to write files to the directory (but not to the archive), it is quite easy to make this directory writable - you can simply use overlayfs to overlay an empty directory over this mount. This way, your changes would be preserved inside a separate directory, while unchanged content from the archive remains available: + +```sh +$ mkdir -p mnt/ upper/ workdir/ merged/ +$ ./main.exe debian-amd64-bookworm-rootfs-270224.tar -f mnt & +[1] 46526 +$ sudo mount -t overlay overlay -olowerdir=./mnt,upperdir=./upper,workdir=./workdir ./merged +$ echo "hi" > merged/hello-world.txt +$ ls -la merged +total 5 +drwxr-xr-x 1 haxala1r users 30 Nov 27 17:37 . +drwxr-xr-x 1 haxala1r users 362 Nov 27 17:36 .. +lrwxrwxrwx 1 root root 0 Jul 2 2023 bin -> usr/bin +drwxr-xr-x 1 root root 0 Jul 2 2023 boot +drwxr-xr-x 1 root root 0 Feb 27 2024 dev +drwxr-xr-x 1 root root 0 Feb 27 2024 etc +-rw-r--r-- 1 haxala1r users 3 Nov 27 17:37 hello-world.txt +drwxr-xr-x 1 root root 0 Jul 2 2023 home +lrwxrwxrwx 1 root root 0 Jul 2 2023 lib -> usr/lib +lrwxrwxrwx 1 root root 0 Jul 2 2023 lib64 -> usr/lib64 +drwxr-xr-x 1 root root 0 Jul 2 2023 media +drwxr-xr-x 1 root root 0 Jul 2 2023 mnt +drwxr-xr-x 1 root root 0 Jul 2 2023 opt +drwxr-xr-x 1 root root 0 Jul 2 2023 proc +drwxr-xr-x 1 root root 0 Feb 27 2024 root +drwxr-xr-x 1 root root 0 Jul 2 2023 run +lrwxrwxrwx 1 root root 0 Jul 2 2023 sbin -> usr/sbin +drwxr-xr-x 1 root root 0 Jul 2 2023 srv +dr-xr-xr-x 1 root root 0 Feb 27 2024 sys +drwxr-xr-x 1 root root 0 Jul 2 2023 tmp +drwxr-xr-x 1 root root 0 Jul 2 2023 usr +drwxr-xr-x 1 root root 0 Feb 27 2024 var +``` \ No newline at end of file