fs-utils
Looks like fs-utils might be the generic solution here:
The aim of this project is to have a set of utilities to access and modify a file system image without having to mount it. To use fs-utils you do not have to be root, you just need read/write access to the image or device. The advantage of fs-utils over similar projects such as mtools is supporting the usage of familiar Unix tools ( ls, cp, mv, etc.) for a large number of file systems.
Linux is supported and there are binary packages available (make sure you also get the rump kernel components on which it is based). Since we're not root we need to install them in our home directory (~/usr
for example):
$ mkdir ~/usr ; cd ~/usr $ dpkg-deb --fsys-tarfile ../netbsd-rump_20140405_i386.deb | tar -xvf - $ dpkg-deb --fsys-tarfile ../netbsd-fs-utils_1.10_i386.deb | tar -xvf -
Add this to ~/.bashrc
:
export PATH="$HOME/usr/bin:$PATH" export LD_LIBRARY_PATH="$HOME/usr/lib"
Then you can:
$ fsu_ls -t ext2fs image.ext2 -l total 2 -rw-r--r-- 1 0 0 12 Apr 9 12:45 a_file.txt $ fsu_cat -t ext2fs image.ext2 a_file.txt just a demo
The filesystem names are a little different than usual: msdos instead of vfat, ext2fs instead of ext2, cd9660 instead of iso9660 etc.
Notes:
- Somehow on my system it works with vfat but not ext2 images. I didn't do a full fs-tools build though, and instead tried a binary package which wasn't an exact match for my distro (which might be why...)
- It looks like the offset=...
mount option isn't supported, so to access a partition inside a whole disk image there seems to be little choice but to copy it out first ...