Currently I'm mounting an ISO to a (readonly) directory (using
mount -o loop command) and then copying the contents to another normal directory. This takes lot of time as the ISO is large. Is this the only way to do so, or is there some alternative?
bsdtar (part of the portable libarchive) can parse lots of file formats. This is handy for those whose fingers are very familiar with tar's options (
bsdtar xfp foo.iso to extract,
bsdtar tf yoyoma.rpm to just inspect the contents).
There's also a bsdcpio for those who are familiar with
Many linux distros now include bsdtar, bsdcpio and libarchive (often as separate packages although it all comes from the libarchive code).
Mounting the image, or using 7zip as already answered are probably the only two solutions. Try them and check if one is faster than the other.
If you really need something more fast, you should probably look in a different direction: instead of changing software, try to use different disks: one for the source image and one for the target directory. Or, try to avoid copying these files and just keep them in the iso image.
For those who use Thunar file manager on linux and want easy and fast solution:
- Open thunar --> Edit --> Configure custom actions...
- Create new item:
- Name: Extract ISO here
- Description: Extracts ISO file
xfce4-terminal -e "7z x %f"
- Open tab Appearance Conditions
- Select only
- Save it and you are ready to extract using right click.
Note that this trick uses and depends on xfce4-terminal and p7zip packages. If you are using different archive manager or terminal - replace commands accordingly.
I have benchmarked suggested utilities for fastest:
FILE=some_file.iso DIR="./unpacked" # time 7z x $FILE -o$DIR # see note below # real 0m0,656s time xorriso -osirrox on -indev $FILE -extract / $DIR # real 0m5,528s mkdir $DIR time bsdtar xp -C $DIR -f $FILE # real 0m5,376s # mkdir $DIR; cd $DIR # time isoinfo -R -X -i ../$FILE # see note below # real 0m0,446s
They were tested against 780M file at nvme ssd. So I would stick with 7z, because of synopsis convinience and fast speed.
Edit: I was hurry about 7z. 7z and isoinfo extracts files, but they are corrupted. That's why they worked such fast I think. I was extracting an AppImage file. Then bsdtar seems the best.