Is there a way to mount a file.tar.bz2 without extracting it onto the filesystem?

15

3

Is there a way to mount a file.tar.bz2 without extracting it onto the filesystem? I don't care if the mount is read only.

Hopefully your answer will also apply to file.tar.gz.

"mount" in this context is meant to be akin to mounting an ISO file.

GlassGhost

Posted 2011-03-14T18:02:47.817

Reputation: 919

2

Tar archives are usually not mounted. Did you think of archivemount http://sourceforge.net/apps/mediawiki/fuse/index.php?title=ArchiveFileSystems#archivemount_-_mount_archives_.28tar.2C_cpio.2C_....29 ?

– Benjamin Bannier – 2011-03-14T18:16:14.803

Answers

7

If you want to mess with fuse they have a plugin to mount archives, including tar.gz.

I'm kind of questioning what you want to do. there is a pretty huge model mismatch between a filesystem (random access to files, random access to bytes in a file) and an archive (needs to be read serially, a write in one byte can will affect all subsequent bytes). At least mount read only.

Rich Homolka

Posted 2011-03-14T18:02:47.817

Reputation: 27 121

404 link, please update to maybe this http://www.cybernoia.de/software/archivemount.html

– user1133275 – 2018-02-24T09:25:30.567

1

The term mount in this context is ill-defined. I'm guessing you want to look inside the tarball without extracting it. One handy utility for this is Midnight Commander. See also Wikipedia Midnight Commander page.

This creates a sort of virtual filesystem for tarballs, rpms, deb and all sorts of other archives. Just fire it up, and navigate to your tarball, and hit Enter. To read a file use F3, F5 to copy a file, F10 quit. On Linux at least there is a convenient command help at the bottom of the screen.

So, to summarize you can read the files inside your tarball and copy them from to your regular filesystem. Hopefully that will do you.

I did a little more checking, and it looks like MC is basically only supported on Unix-like systems like Linux, though there is a Windows port here of some sort. However, you don't state what your OS is. I suggest you do so.

Faheem Mitha

Posted 2011-03-14T18:02:47.817

Reputation: 418

1

As already stated, FUSE can be used. Here is a link to reading different archives using FUSE. libarchive is the first one, which allows mounting specifically tar.bz2 archives:

http://sourceforge.net/p/fuse/wiki/ArchiveFileSystems/?version=1

and here is a link to an old article that gives a tutorial on how to use this:

http://archive09.linux.com/feature/132196

Luciano

Posted 2011-03-14T18:02:47.817

Reputation: 149

First link is broken already, archived version: https://web.archive.org/web/20150906220307/http://sourceforge.net/p/fuse/wiki/ArchiveFileSystems/ new Wiki is https://github.com/libfuse/libfuse/wiki

– Tino – 2016-11-25T08:51:25.953

0

I'm able to mount tar.bz2 and tar.gz files with the Nemo file manager (via the context menu when you right-click on a file). Nemo comes with Cinnamon, although I tried it while using XFCE (with a Xubuntu 18.04 Linux installation). I'm not sure if there are any dependencies that don't come with installing just plain Nemo, but if so, installing cinnamon-desktop-environment should install everything you need and a whole lot more.

Brōtsyorfuzthrāx

Posted 2011-03-14T18:02:47.817

Reputation: 163

0

Do you really need to mount it? Why is using the archive manager (Linux/gnome) not sufficient? If you're going to need it frequently then it seems (to me at least) that you might be better off just unbzing and mounting it normally.

You might try using an OS that allows compression of entire file systems if the simpler options aren't sufficient. For example FreeBSD with the ZFS file system is one possibility.

hotei

Posted 2011-03-14T18:02:47.817

Reputation: 3 645