Linux – How to convert a TAR file into an ISO file

convertdisk-imageisolinuxtar

I have a Linux TAR file that I would like to convert directly into an ISO. Is there a way to do this, preferably, without having to extract the contents of the file first?

This would be similar to the following question; however, this is focused on plain or straight-up tar files and not related to bzip or a bzipped tar.

This is also something that I intended to use within a script and the reason that I do not want to extract it first.

Best Answer

Use AVFS to access the contents of the tar archive as if it was a directory. AVFS is a virtual filesystem built on FUSE. Point your favorite ISO builder to the directory inside the tar archive.

mountavfs
cd ~/.avfs/path/to/archive.tar\#
genisoimage -o /path/to/iso .