8

It seems one cannot mount a tar file (read only), similarly as one mounts an ISO image file. At least, I have not found any implementation.

It would be useful, for example to run a find command inside.

Is this really (or practically) impossible to implement? Why?

UPDATE By accepted answered, this is indeed possible, though a program (not included in present distributions) must be instaled. It worked for me. I copy the installation and use steps in my scenario (Fedora 12).

  # yum install fuse fuse-libs fuse-devel 
  # yum install libarchive libarchive-devel
  # cd /tmp && wget http://www.cybernoia.de/software/archivemount/archivemount-0.6.0.tar.gz
  # tar xzf archivemount-0.6.0.tar.gz && cd archivemount-0.6.0
  # ./configure && make && make install
  # man archivemount
  #  archivemount -o ro /tmp/mytar.tgz /mnt/tt
5
  • 1
    tar -tf yourfile.tar | grep 'pattern'
    – Javier
    May 4, 2010 at 14:42
  • Not exactly an answer but you could use tar -tvf somefile.tar | grep something. voted up for beating me to it. :)
    – egorgry
    May 4, 2010 at 14:42
  • I know that, but find lets you specify a lot of criteria and logic (sizes, timestamps), tar+grep falls a little short.
    – leonbloy
    May 4, 2010 at 14:46
  • you could pipe to find and get creative.
    – egorgry
    May 4, 2010 at 14:56
  • I love playing with pipes and command lines, but that doesnt apply here. 'find' is not fed from stdin but from som path in some filesystem
    – leonbloy
    May 4, 2010 at 15:14

2 Answers 2

8

Traditionally, no it's not possible.

However, you can do so using the FUSE filesystem archivemount under Linux.

IMNSHO this is a bit of a novelty and not usually necessary, but I can see a few edge cases for it.

1
  • One of possible use cases is mine - I'd like to be able to mount archives on remote server, to be able to perform incremental backups to them by rsync. Not sure if it will work fast. Mar 19, 2012 at 11:47
1

The package is available in Ubuntu 11.10, alas broken.

One can install it via this workaround:

mkdir -p ~/src
cd ~/src

sudo aptitude install build-essential devscripts debian-archive-keyring libfuse-dev libarchive-dev
apt-get source archivemount
gpg --keyring /usr/share/keyrings/debian-archive-keyring.gpg --verify *dsc

cd archivemount-0.6.1
cat << EOF | patch -p0
--- debian/control
+++ debian/control
@@ -8,7 +8,7 @@

 Package: archivemount
 Architecture: linux-any
-Depends: \${shlibs:Depends}, \${misc:Depends}, fuse (>=2.8.5-2)
+Depends: \${shlibs:Depends}, \${misc:Depends}, fuse-utils (>=2.8.4-1.4ubuntu1)
 Description: mounts an archive for access as a file system
  archivemount is a FUSE based file system for Unix variants, including Linux.
  Its purpose is to mount archives to a mount point where it can be read from
EOF
dch --nmu 'Depend on fuse-utils instead of fuse on Oneiric Ocelot.'
dpkg-buildpackage

cd ..
sudo dpkg -i archivemount_0.6.1-2.1_amd64.deb

The last step did not work for me, so I

cd archivemount-0.6.1./
configure && make && sudo make install

instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .