* Getting dd to pad the *last* output block
@ 1994-08-09 15:15 Jamie Watson
1994-08-10 0:53 ` dan
1994-08-10 13:32 ` Andreas Karrer
0 siblings, 2 replies; 3+ messages in thread
From: Jamie Watson @ 1994-08-09 15:15 UTC (permalink / raw)
Does anyone know how to get the Ultrix "dd" to pad the last output block
to whatever the specified block size is, when reading from stdin? I know
this sounds like a strange problem, and probably sounds more like user
error than anything else, but I have been fighting with this for a very
long time (several years, in fact), and I still can't get it to do what
I want. The kind of command line I am talking about is this:
compress < xc-1.tar | dd obs=10k conv=sync of=/dev/nrmt1l
I have tried every combination I can think of using "ibs=xxx obs=xxx",
using only "obs=xxx", using "bs=xxx", with and without "conv=sync",
and I can't get it to work. Either it doesn't pad the last block,
and even admits that fact by reporting something like this:
1234+0 blocks in
567+1 blocks out
Or it reads partial input blocks, and immediately pads and writes them,
which it also admits by reporting something like this:
1234+5678 blocks in
8765+0 blocks out
Of course, in this case the output is totally hosed.
Most amazing of all, if the input is a file, it works exactly the way
I want it to, like this:
$ dd if=xc-1.tar.Z bs=10k conv=sync of=/dev/nrmt1h
1234+1 blocks in
1235+0 blocks out
Why the heck can't I get it to do this when reading from stdin? Please
don't suggest that I simply keep the files I need to write to tape in
the appropriate format on disk; the world is not that simple of a place
for me any more. In case you are wondering what I am doing, and why I
can't use this simple solution, a brief explanation follows.
As some readers of this group may know, I have been offering distribution
of the X Window System sources free of charge in Europe for quite a few
years now (since V11R1). I am now offering the R6 distribution, and I
would like to make all of the tapes on my DECstation 5000/50 at home. I
have a DEC TZ-30, a DEC TLZ06, a Tandberg QIC-525 and an Exabyte 8205
tape drive. The problem I am having is that the tapes I am writing are
going to be read on a variety of different computers and tape drives,
and I need to make them as portable as possible. With previous releases
I only offered TZ-30 and QIC tapes; it seems that the DAT and Exabyte
tapes are considerably more tricky to make totally portable than QIC.
I have had to make the format of the distribution considerably more
complex with this release, as well. With previous releases, the basic
data organization was identical for both QIC and TK tapes; everything
was compressed, so I could just keep the compressed files on my disk,
and write them out with dd avoiding the stdin problem. But X.V11R6
has finally grown so large that it won't fit on a single TK-50 tape,
even when compressed. However, the "gzip" program does a lot better
job of compressing than the traditional "compress" program does, so
if I use that for TK tapes, and distribute the gzip sources as well,
I can still get everything on one cartridge.
Then, when I started making DAT and Exabyte tapes, I realized that
there is no point in compressing the data at all on those because
it will all fit easily on one cartridge, even when I use 60m DAT
and 52m Exabytes.
So now I need the data in three formats - uncompressed, compressed
and gzipped. Obviously I don't have the disk space to keep all
three on hand (actually I barely have enough space to keep one),
so I have written a Makefile that will convert from the format I
have on disk to whatever is appropriate for the kind of tape I am
writing. But then I get bitten by this stupid "dd" weirdness.
It turns out that there are various combinations of computers,
operating systems and tape drives, especially Exabyte and DAT tape
drives, which are very sensistive to tape block size. If you tell
them that the tape is written with 10k blocks, they had better *all*
be 10k blocks, including the last one. If the last one is truncated,
the way Ultrix "dd" writes it, you can get a "read I/O error". When
this happens, lots of bads results are possible. Sometimes you lose
the data from the partial tape block. Sometimes the system resets
the tape drive and/or controller, which can cause the tape to rewind,
which is not a good idea when the tape contains multiple records.
Various other nastiness has also been reported to me. Sigh.
So, if anyone is still reading this far along, any help I get on this
could pay off by making quite a few people happy across Europe. I'm
not holding my breath, but you never know...
Thanks for any assistance,
jw@adasoft.ch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Getting dd to pad the *last* output block
1994-08-09 15:15 Getting dd to pad the *last* output block Jamie Watson
@ 1994-08-10 0:53 ` dan
1994-08-10 13:32 ` Andreas Karrer
1 sibling, 0 replies; 3+ messages in thread
From: dan @ 1994-08-10 0:53 UTC (permalink / raw)
In <Cu9x20.33G@adasoft.ch>, jw@adasoft.ch (Jamie Watson) writes:
)Does anyone know how to get the Ultrix "dd" to pad the last output block
)to whatever the specified block size is, when reading from stdin? I know
)this sounds like a strange problem, and probably sounds more like user
)error than anything else, but I have been fighting with this for a very
)long time (several years, in fact), and I still can't get it to do what
)I want. The kind of command line I am talking about is this:
)
) compress < xc-1.tar | dd obs=10k conv=sync of=/dev/nrmt1l
I would have thought this would work, but I guess there is a comflict
between obs= and conv=sync. If you made obs=2k or something, perhaps
compress < xc-1.tar | dd obs=2k | dd bs=2k conv=sync of=/dev/nrmt1l
would work.
However, with the amount of time you have aprrently spent on this, you
could just write the half page C program to do the job.
Cheers,
Dan Ts'o 713-798-3331
Div. Neuroscience FAX: 713-798-3897
Baylor College of Medicine
1 Baylor Plaza S553 dan@dna.neusc.bcm.tmc.edu
Houston, TX 77030 tso@cephalo.neusc.bcm.tmc.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Getting dd to pad the *last* output block
1994-08-09 15:15 Getting dd to pad the *last* output block Jamie Watson
1994-08-10 0:53 ` dan
@ 1994-08-10 13:32 ` Andreas Karrer
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Karrer @ 1994-08-10 13:32 UTC (permalink / raw)
jw@adasoft.ch (Jamie Watson) writes:
>Does anyone know how to get the Ultrix "dd" to pad the last output block
>to whatever the specified block size is, when reading from stdin? I know
>this sounds like a strange problem, and probably sounds more like user
>error than anything else, but I have been fighting with this for a very
>long time (several years, in fact), and I still can't get it to do what
>I want. The kind of command line I am talking about is this:
> compress < xc-1.tar | dd obs=10k conv=sync of=/dev/nrmt1l
use "buffer -B" instead of dd.
version 1.17 is on ftp.ethz.ch:pub/src, i'm not sure if Lee McLoughlin of
Imperial College has published a newer version. If you have to deal
with devices like a TK-50, buffer is a win anyway.
should work on any machine that supporst sysv shared memory and
semaphores; it certainly works on ultrix/sunos/solaris; not sure about
DEC-OSF/1.
+-----------
Andi Karrer, Institute for Electronics, ETH Zuerich, Switzerland
karrer@bernina.ethz.ch
- CH stands for Calvin & Hobbs, the most influential Swiss religion
<2n04i5$44j@hebron.connected.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1994-08-10 13:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-08-09 15:15 Getting dd to pad the *last* output block Jamie Watson
1994-08-10 0:53 ` dan
1994-08-10 13:32 ` Andreas Karrer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox