Extract an ext4 filesystem image *without root access*
On occasion, one gets ext4 images from the internet, and one would like to extract them without root access.
I understand that with root access, one would do a loopback mount. Suppose one does not have root access.
Even if one does have root access, there are reasons why one would perhaps not want to mount some random ext4 filesystem off the internet as root, even if one does specify nosuid
and nodev
. For instance, odds are very good that your regular user will not have read access to the entire thing, requiring root access to do even the most basic operation, like ripgrep. This is dumb. There has got to be a better way.
Yes, I'm aware it is impossible to preserve the original permissions when extracting this way, and this should not be done if this filesystem actually needs to be repackaged again with the original permissions.
Why yes, random stranger, there is in fact a way. Just use 7z
:
> mkdir fsroot
> cd fsroot
> 7z x ../the-ext4.img