<?xml version="1.0" encoding="UTF-8"?><!-- generator="lyceum/1.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Tips and Tricks:  Splitting tar archives on the fly</title>
	<link>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/</link>
	<description>Red Hat Magazine</description>
	<pubDate>Wed, 27 Aug 2008 23:57:36 +0000</pubDate>
	<generator>http://lyceum.ibiblio.org/?v=1.0.2</generator>

	<item>
		<title>by: Ed Weinberg</title>
		<link>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-49899</link>
		<pubDate>Thu, 31 Jan 2008 04:29:54 +0000</pubDate>
		<guid>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-49899</guid>
					<description>I use this to "ghost" partitions.  My kids C: drive is /dev/hda2.  I backup that "file" (really a partition) and when they break it I can easily restore it.</description>
		<content:encoded><![CDATA[<p>I use this to &#8220;ghost&#8221; partitions.  My kids C: drive is /dev/hda2.  I backup that &#8220;file&#8221; (really a partition) and when they break it I can easily restore it.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Klaus Lichtenwalder</title>
		<link>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-39764</link>
		<pubDate>Fri, 14 Dec 2007 19:49:25 +0000</pubDate>
		<guid>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-39764</guid>
					<description>Just a few nitbits... If you want to use stdin/stdout with tar, it's simply a -
e.g.: tar cf - . &#124; (cd /elsewhere; tar xf -)

cat always appends its arguments to stdout, so 
  cat $(prefix)* &#124; command
is sufficient. I don't know and (honestly) don't care if gnu-tar sends its output to stdout if no f argument given, every other unix uses the default tape device (which is /dev/rmt) if no f argument given (I have to work with Solaris and AIX too...).
</description>
		<content:encoded><![CDATA[<p>Just a few nitbits&#8230; If you want to use stdin/stdout with tar, it&#8217;s simply a -<br />
e.g.: tar cf - . | (cd /elsewhere; tar xf -)</p>
<p>cat always appends its arguments to stdout, so<br />
  cat $(prefix)* | command<br />
is sufficient. I don&#8217;t know and (honestly) don&#8217;t care if gnu-tar sends its output to stdout if no f argument given, every other unix uses the default tape device (which is /dev/rmt) if no f argument given (I have to work with Solaris and AIX too&#8230;).
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Alexander Todorov</title>
		<link>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-37064</link>
		<pubDate>Mon, 03 Dec 2007 13:06:12 +0000</pubDate>
		<guid>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-37064</guid>
					<description>Andreas,
as it seems -v option directs the output either to stdout or stderr. 
tar -czvf file.tar.gz [other args] : file list goes to stdout
tar -czv [other args] : file list goes to stderr.

First line directs tar to save the output to file.tar.gz so the listing goes to stdout.
Note that the second line is not specifying -f and tar assumes /dev/stdout by default.

The example I've given uses -f /dev/stdout to be more clear, as vsego noted above. Apparently that leads to problems. I believe tar is not checking if -f is "/dev/stdout". That sounds like a bug(either in code or in documentation).

Unfortunately I'm not aware of any way that you can recover your archive (split doesn't reaaly have anything ot do here). I advise you to ask the question on a tar speciffic user/developers mailing list or forum.
And you're right, not paying attention or validating your archives is a big mistake (which you'll not make anymore probably) especially when archiving your whole system.</description>
		<content:encoded><![CDATA[<p>Andreas,<br />
as it seems -v option directs the output either to stdout or stderr.<br />
tar -czvf file.tar.gz [other args] : file list goes to stdout<br />
tar -czv [other args] : file list goes to stderr.</p>
<p>First line directs tar to save the output to file.tar.gz so the listing goes to stdout.<br />
Note that the second line is not specifying -f and tar assumes /dev/stdout by default.</p>
<p>The example I&#8217;ve given uses -f /dev/stdout to be more clear, as vsego noted above. Apparently that leads to problems. I believe tar is not checking if -f is &#8220;/dev/stdout&#8221;. That sounds like a bug(either in code or in documentation).</p>
<p>Unfortunately I&#8217;m not aware of any way that you can recover your archive (split doesn&#8217;t reaaly have anything ot do here). I advise you to ask the question on a tar speciffic user/developers mailing list or forum.<br />
And you&#8217;re right, not paying attention or validating your archives is a big mistake (which you&#8217;ll not make anymore probably) especially when archiving your whole system.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Andreas</title>
		<link>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-36513</link>
		<pubDate>Fri, 30 Nov 2007 09:42:06 +0000</pubDate>
		<guid>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-36513</guid>
					<description>Hi Alexander,

I applied your tip, but the result is a mess up. I followed your command inputs:

$ tar -czf /dev/stdout /home &#124; split -d -b 4000m - backupPART

It produced two files burnt onto 2 DVD+R. [Estimating the *real* size of a DVD+R media is another story (Different meaning of 'GB', different manufactures have different DVD+R media sizes...).]

I did not verify the compression, the creation of the tarball nor the DVD+R burning. I was on the hurry and i didn't know how. (Heavy human failure, I know.)

Then i re-partioned my laptop harddisk, installed fedora 8 and run your tar extract command:

$ cat backupPART* &#62;&#62; /dev/stdout &#124; tar -xzf /dev/stdin

I get this:

gzip: stdin: not in gzip format
tar: Child died with signal 13

My tarball seams to be corrupt. Googling up and down the web I found 'gzrecover', 'TarFixer' and the 'GNU tar manual' by FSF.

gzrecover crashed by memory access error/failure; TarFixer can't be applied to compressed tarballs; but the manual make me learning 'tar'.

I asked for help at LinuxQuestions.org and fedoraforum.org and the other user assumed a mess up in the target file (backupPART) due to using the '/dev/stdout' pseudo device. They said, any (error) message produced while running tar would re-direct to a split backupPART file. I didn't believe that. In spite of being a real Linux newbie, I know that a process (can have/) has three standard I/O streams: stdin, stdout and stderr attached to user's tty. A second Terminal running i.e. 'ls -la' should not interfere the first. And a program like 'tar' should stream error or diagnostic messages to stderr and not to stdout.

Really? If you run 'tar' in verbose mode what happens? Is tar's output sterr or stdout? I would guess stderr, because listing processed/tar'ed files is a kind of diagnostic message and not the main purpose (as 'ls').

However, I am able to replicate a messy tarball using your tip. But it's not exactly the command you presented. I added (accidentally) the '-v' option to 'tar' and all the verbose output messages did go to stdout resp. split's stdin.

Do you know how can I recover my mixed up / corrupted tarball? I'm a Linux newbie und don't know the tiny command* deleting tar's verbose listing from by backupPART. But it should go like this:

Read a (next) byte of tarball.mixed
If byte.mixed is '/' and next bytes are 'home/..'
  then delete these bytes
  else go to begin.

Thank you very much.

Andreas

*If You have any old RH Training textbooks you want to get rid off, send it to me. I'm eager for Linux knowledge:-)</description>
		<content:encoded><![CDATA[<p>Hi Alexander,</p>
<p>I applied your tip, but the result is a mess up. I followed your command inputs:</p>
<p>$ tar -czf /dev/stdout /home | split -d -b 4000m - backupPART</p>
<p>It produced two files burnt onto 2 DVD+R. [Estimating the *real* size of a DVD+R media is another story (Different meaning of &#8216;GB&#8217;, different manufactures have different DVD+R media sizes&#8230;).]</p>
<p>I did not verify the compression, the creation of the tarball nor the DVD+R burning. I was on the hurry and i didn&#8217;t know how. (Heavy human failure, I know.)</p>
<p>Then i re-partioned my laptop harddisk, installed fedora 8 and run your tar extract command:</p>
<p>$ cat backupPART* &gt;&gt; /dev/stdout | tar -xzf /dev/stdin</p>
<p>I get this:</p>
<p>gzip: stdin: not in gzip format<br />
tar: Child died with signal 13</p>
<p>My tarball seams to be corrupt. Googling up and down the web I found &#8216;gzrecover&#8217;, &#8216;TarFixer&#8217; and the &#8216;GNU tar manual&#8217; by FSF.</p>
<p>gzrecover crashed by memory access error/failure; TarFixer can&#8217;t be applied to compressed tarballs; but the manual make me learning &#8216;tar&#8217;.</p>
<p>I asked for help at LinuxQuestions.org and fedoraforum.org and the other user assumed a mess up in the target file (backupPART) due to using the &#8216;/dev/stdout&#8217; pseudo device. They said, any (error) message produced while running tar would re-direct to a split backupPART file. I didn&#8217;t believe that. In spite of being a real Linux newbie, I know that a process (can have/) has three standard I/O streams: stdin, stdout and stderr attached to user&#8217;s tty. A second Terminal running i.e. &#8216;ls -la&#8217; should not interfere the first. And a program like &#8216;tar&#8217; should stream error or diagnostic messages to stderr and not to stdout.</p>
<p>Really? If you run &#8216;tar&#8217; in verbose mode what happens? Is tar&#8217;s output sterr or stdout? I would guess stderr, because listing processed/tar&#8217;ed files is a kind of diagnostic message and not the main purpose (as &#8216;ls&#8217;).</p>
<p>However, I am able to replicate a messy tarball using your tip. But it&#8217;s not exactly the command you presented. I added (accidentally) the &#8216;-v&#8217; option to &#8216;tar&#8217; and all the verbose output messages did go to stdout resp. split&#8217;s stdin.</p>
<p>Do you know how can I recover my mixed up / corrupted tarball? I&#8217;m a Linux newbie und don&#8217;t know the tiny command* deleting tar&#8217;s verbose listing from by backupPART. But it should go like this:</p>
<p>Read a (next) byte of tarball.mixed<br />
If byte.mixed is &#8216;/&#8217; and next bytes are &#8216;home/..&#8217;<br />
  then delete these bytes<br />
  else go to begin.</p>
<p>Thank you very much.</p>
<p>Andreas</p>
<p>*If You have any old RH Training textbooks you want to get rid off, send it to me. I&#8217;m eager for Linux knowledge:-)
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Alexander Todorov</title>
		<link>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-28833</link>
		<pubDate>Thu, 25 Oct 2007 06:35:31 +0000</pubDate>
		<guid>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-28833</guid>
					<description>vsego,
You are right. Using /dev/stdin and /dev/stdout is to be more clear.</description>
		<content:encoded><![CDATA[<p>vsego,<br />
You are right. Using /dev/stdin and /dev/stdout is to be more clear.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: vsego</title>
		<link>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-28752</link>
		<pubDate>Wed, 24 Oct 2007 22:21:00 +0000</pubDate>
		<guid>http://www.redhatmagazine.com/2007/10/24/tips-from-an-rhce-splitting-tar-archives-on-the-fly/#comment-28752</guid>
					<description>Isn't it easier to just omit the "f"?
tar cz $(DIRECTORY_OR_FILE_TO_COMPRESS) &#124; split -d -b $(CHUNK_SIZE_IN_BYTES) - $(FILE_NAME_PREFIX)
cat $(FILE_NAME_PREFIX)* &#124; tar xz</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t it easier to just omit the &#8220;f&#8221;?<br />
tar cz $(DIRECTORY_OR_FILE_TO_COMPRESS) | split -d -b $(CHUNK_SIZE_IN_BYTES) - $(FILE_NAME_PREFIX)<br />
cat $(FILE_NAME_PREFIX)* | tar xz
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
