Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Theoretically 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. –  Ignacio Vazquez-Abrams Sep 29 '11 at 20:20
    
Why do you want to do this without extracting the tar? –  Nils Sep 29 '11 at 20:23
    
I wonder if there is a way to pipe it to something like stdin and then pipe it on over to the iso file ??? –  John Sep 29 '11 at 20:23
    
I am not sure if this would work or not, since I am not 100% for sure what the command is doing. -- tar -jxf /dev/stdin file.tar | mkisofs -o file.iso -stream-media-size 512 –  John Sep 29 '11 at 20:39
    
The -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). –  Abbafei Dec 28 '12 at 6:08
add comment

3 Answers

up vote 4 down vote accepted

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 .
share|improve this answer
    
@ 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. –  John Sep 29 '11 at 22:03
add comment

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.

share|improve this answer
add comment

You must extract it but you dont must extract it to your harddrive you can use stdtout and pipe it to genisoimage or mkisofs

tar --to-stdout xf tareddata.tar | genisoimage -o image.iso tareddata

test it: mount -o loop image.iso /mnt

you can write a small script to automize this issue

greez bull

share|improve this answer
    
And how would it tell one file from the next? –  Ignacio Vazquez-Abrams Sep 29 '11 at 21:02
    
When 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'. –  John Sep 29 '11 at 21:09
    
the 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 –  bulleric Sep 29 '11 at 21:15
    
Sorry, I'm fairly sure there's no way this can work; -1 . –  MadHatter Sep 30 '11 at 9:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.