Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archivemount can't read .img.gz #25

Open
mr-who2012 opened this issue Nov 2, 2022 · 4 comments
Open

archivemount can't read .img.gz #25

mr-who2012 opened this issue Nov 2, 2022 · 4 comments

Comments

@mr-who2012
Copy link

mr-who2012 commented Nov 2, 2022

# archivemount ./sda2_Linux.img.gz /media/archive -o readonly

Unrecognized archive format

This happens with all gzipped-images on my backup-hdd. p7zip can open these files without problems.
The image was created like this:

dd if=/dev/sda2 bs=1M conv=noerror,sync | pv -s50G -cN "sda2" | gzip -c -9 > /media/backup/sda2_Linux.img.gz

Versions:

Linux-Version: Ubuntu Bionic (18.04)
archivemount-version 0.9.1
libfuse-version: 2.9.7
libfuse-dev-version: 2.9.7

@mxmlnkn
Copy link

mxmlnkn commented Jan 29, 2023

Archivemount does not support pure gzip files. It supports gzip-compressed TARs and other archives but not disk images. You can try ratarmount, which can mount even single gzip files and show the contents. But in your case, it will only show the .img file not the actual files on the file system. For that, you would have to mount the .img file again like so:

python3 -m pip install --user ratarmount
ratarmount /media/backup/sda2_Linux.img.gz mounted-gzip-file
mount -o loop mounted-gzip-file/sda2_Linux.img /mnt/disk.img.partition

See also this StackOverflow question.

@nabijaczleweli
Copy link

nabijaczleweli commented Jun 16, 2024

abjectly false and an ad; archivemount does this with -o formatraw:

$ gzip -9 < archivemount.c > archivemount.c.gz
$ ./archivemount -o formatraw archivemount.c.gz mnt
$ l mnt/
total 67K
-r--r--r-- 1 nabijaczleweli users 67K 06-16 02:48 data
$ head mnt/data
/*

   Copyright (c) 2005-2018 Andre Landwehr <andrel@cybernoia.de>

   This program can be distributed under the terms of the GNU LGPL.
   See the file COPYING.

   Based on: fusexmp.c and sshfs.c by Miklos Szeredi <miklos@szeredi.hu>

   Contributions by: Niels de Vos <niels@nixpanic.net>

@mxmlnkn
Copy link

mxmlnkn commented Jun 16, 2024

I didn't know that such an option existed. However, when trying out a minimal example, I get this error:

git clone https://github.com/cybernoid/archivemount.git
cd archivemount
autoreconf -i && ./configure && make
./archivemount --version
# archivemount version 0.9.1
# FUSE library version: 2.9.9
# fusermount3 version: 3.10.5
# using FUSE kernel interface version 7.19
echo foo > bar
gzip -k bar
mkdir mnt
./archivemount -o formatraw bar.gz mnt
# ls -lA mounted/
# ls: cannot access 'mounted/bar': Operation not permitted
# total 4
# -????????? ? ?       ?          ?            ? bar
cat mounted/bar
# cat: mounted/bar: Operation not permitted

Interestingly, it only works when compressing the file using your command line gzip -9 < bar > bar2.gz:

./archivemount -o formatraw bar2.gz mnt
ls -lA mnt
# total 1
# -r-x------ 1 user user 4 Jun 16 10:02 data
cat mnt/data
# foo

There also is the difference that the mounted bar.gz shows a file bar, while the over shows a file data. By analyzing the gzip files with rapidgzip --analyze bar.gz, it can be shown that bar.gz contains a file name in the gzip header bar, while bar2.gz does not. It seems that archivemount cannot handle file names in gzip headers.

And yes, I may have been a bit overly eager to share my pet project. I'm sorry about that. Note that there are many other alternatives, such as fuse-archive, fsspec, dissect that similarly improved things over archivemount.

@nabijaczleweli
Copy link

nabijaczleweli commented Jun 16, 2024

Yes, and you may recognise this as #18. I've fixed this in archivemount-ng (this specifically is 3409787). As well as all other known bugs. And a plethora of ones no-one else has found. I already got the cnanakos@ co-sign, so expect it in Debian in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants