39

I am looking for a way to mount a ZIP archive as a filesystem so that I can transparently access files within the archive. I only need read access -- the ZIP will not be modified. RAM consumption is important since this is for a (resource constrained) embedded system. What are the available options?

5
  • Have you tried mount -o loop option?
    – Sreeraj
    Nov 19, 2014 at 9:43
  • Yes, the question is which filesystem to use.
    – Grodriguez
    Nov 19, 2014 at 9:59
  • 1
    If you're looking for compressed read-only filesystem, consider using squashfs.
    – WGH
    Feb 28, 2015 at 14:17
  • I am not looking for "a compressed read-only file system" in a generic way. I am specifically looking for a way to mount a zip file as a read-only file system.
    – Grodriguez
    Mar 2, 2015 at 9:58
  • See SU:367540 for a similar question on WinNT.
    – n611x007
    Sep 28, 2016 at 17:59

2 Answers 2

38

fuse-zip is an option and claims to be faster than the competition.

# fuse-zip -r archivetest.zip /mnt

archivemount is another:

# archivemount -o readonly archivetest.zip  /mnt

Both will probably need to open the whole archive, therefore won't be particularly quick. Have you considered extracting the ZIP to a HDD or USB-stick beforehand and simply mounting that read-only?


There are also other libraries like fuse-archive and ratarmount which supposedly are more performant under certain situations and provide additional features.

4
  • 1
    Speed is not a problem, but RAM consumption is. USB or HDD is not an alternative. This is an embedded system without an HDD or USB ports.
    – Grodriguez
    Nov 19, 2014 at 9:43
  • I suppose the bottom line is that you'll need to test it within your particular situation and see which, if any, is the best for memory usage. I'd have thought it depends on how large your archive is and also how many files are within that archive. If you have control of how the ZIP file is created, you could consider a different format such as a raw disk image which can be loop mounted - that may save RAM. Nov 19, 2014 at 9:50
  • Yes, I will have to test. But before that I wanted to know if others had any experience they could share :) (BTW I don't have control overthe ZIP file).
    – Grodriguez
    Nov 19, 2014 at 9:57
  • 6
    @Grodriguez With an 1GB+ inner file, fuse-zip's memory usage was 1GB+. For the same, archivemount's mem usage was still low.
    – n611x007
    Sep 29, 2016 at 16:47
10

You can use fuse-zip to mount the ZIP archive as read only.

  1. Install fuse-zip on your system.

    On Ubuntu run:

    sudo apt-get install fuse-zip
    

    On RHEL / CentOS / Fedora run:

    yum install fuse-zip
    
  2. Run below command to mount zip as read only:

    fuse-zip -o ro /path/abcd.zip /path/to/mount/directory
    
  3. Use below command to unmount directory:

    fusermount -u /path/to/mount/directory
    
5
  • Thank you. Is there any info available about memory consumption? What works well for desktop might not work that well in resource constrained environments.
    – Grodriguez
    Nov 19, 2014 at 9:42
  • 1
  • No mentions of memory consumption there.
    – Grodriguez
    Nov 19, 2014 at 9:57
  • 2
    Google Code has closed, link above moved to bitbucket.org/agalanin/fuse-zip/wiki/PerformancePage
    – silpol
    Jan 11, 2019 at 7:21
  • No mention of random access (seek) speed either. In my case I have a .zip with a single 7GB, and would like reasonable RAM usage and random access. Doing this half-efficiently would require caching things like compression block positions, I suspect nothing ready does this? Aug 17, 2021 at 9:46

You must log in to answer this question.

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