How to convert a TAR file into an ISO file
Solution 1
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 .
Solution 2
If your primary objectives are to expedite the process and to avoid unnecessary disk activity for performance reasons, and you have plenty of RAM to spare relative to the size of your tarball, you can extract the .tar into RAM using tmpfs. This option is very likely the fastest available, unless you're able to get @bulleric's pipe approach to work and you're reading from one disk and writing to another.
Solution 3
archivemount /file.tar /media/ISO
or uncompressed .tar and
genisoimage -o myfile.iso directory_src
(can be folder /media/ISO
or point mount /media/cdrom
)
Related videos on Youtube
John
Just a random person looking for ways to expand my knowledge and passion for technology.
Updated on September 18, 2022Comments
-
John over 1 year
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.
-
Ignacio Vazquez-Abrams over 12 yearsTheoretically it could be done without having to extract each of the files to disk (they have to be extracted from the archive in order to be put into the new image), but I don't know of anything that does.
-
Nils over 12 yearsWhy do you want to do this without extracting the tar?
-
John over 12 yearsI wonder if there is a way to pipe it to something like stdin and then pipe it on over to the iso file ???
-
Abbafei over 11 yearsThe -stream-media-size option was actually made for this! :-) See the genisoimage man page for info -- currently it mentions tar in the docs for this option (and uses it in the examples for it).
-
-
Ignacio Vazquez-Abrams over 12 yearsAnd how would it tell one file from the next?
-
John over 12 yearsWhen I run this I get a series of errors, the first is: tar: You must specify one of the
-Acdtrux' or
--test-label' options. The next error is: I: -input-charset not specified, using utf-8 (detected in locale settings). The last error is: genisoimage: No such file or directory. Invalid node - 'tareddata'. -
bulleric over 12 yearsthe first problem i solvet i have take a wrong option in tar ; the 2nd one hmm in my opinion the first directory get extractet the same name as the as the unextracted directory like tardata.tar tardata
-
John over 12 years@ Gilles - thanks for the idea. This looks like it might be an excellent idea; however, I am on CentOS 6 and am running into problems trying to get AVFS installed.
-
MadHatter over 12 yearsSorry, I'm fairly sure there's no way this can work; -1 .