Summary: Cross platform DEC UNIX tar and cpio compatibility

From: Pidgeon, Phillip <PPIDGEON_at_omc.otis.utc.com>
Date: Thu, 01 Aug 1996 03:06:00 -0700 (PDT)

My original posting:

>Hi,
>
>Can anyone give a concise rundown and methods to resolve issues of cross
>platform DEC UNIX tar and cpio compatibility. I have directly had some
>issues with both SUN's and HP systems unfortunately in other countries,
>failing to read tar and cpio 4mm DAT tapes and would like to understand all

>the issues involved.
>
>In our case are using DEC Unix 3.2c and have TLZ07 DAT tape drives.
>
>Regards,
>Phil Pidgeon
>OTIS Engineering Center
>ppidgeon_at_omc.otis.utc.com

Thanks to all the people who responded:
David Warren warren_at_atmos.washington.edu
Claude Soma soma_c_at_decus.fr
Roy Langridge rlangrid_at_progress.co.uk
Carl Privitt cprivitt_at_tamu.edu
Stan Huhman huhman_at_rg.deere.COM
rioux rioux_at_ip6480nl.ce.utexas.EDU

Regards,
Phil Pidgeon.

Full Responses received:

111111111111111111

I can't speak for HP, but I use tar between DEC and SUN all the time. They
are
the same.
 --
David Warren INTERNET: warren_at_atmos.washington.edu
(206) 543-0945 Fax: (206) 543-0308
University of Washington
Dept of Atmospheric Sciences, Box 351640
Seattle, WA 98195-1640
 ----------------------------------------------------------------------------
 ---
 -
DECUS E-PUBS Library Committee representative
SeaLUG DECUS Chair

2222222222222222222

Hi
If the problem is the utilities ex tar , and if you have posix compliant
system
you can use pax (the posix tar)
Claude Soma

3333333333333333333

Hi ,
        I don't know the answer about cpio, but I have experienced problems
with sun and HP dat drives. At the time, (and this may have changed), a dump
tape written on a HP dat drive, connected to a sun machine, had problems
when being read back on a sun dat drive,(Wangtec ?), both of which are DDS2
DAT drives. The tape would read quiet happily until about half way through,
when it would give up. We could only come up with the suggestion that the
problem was due to differing tape speeds, and varying skew of the helical
tape tracks. It was, however, a definately repeatable problem. This may have
no bearing on yourself, since you are using digital, but be aware that DDS2
dat drives may not be physically interchangable. Also I have heard the line
several times, that tape drives are backup devices, not interchange devices!

Hope this helps, and dosen't dampen your spirits too much.

Regards

Roy Langridge
************************************************
* *
* Progress Computer Systems Ltd. *
* 2 Chiltern Court *
* Asheridge Road *
* Chesham *
* Bucks *
* HP5 2PX *
* *
* Tel: 01494 778877 *
* Fax: 01494 791501 *
* *
* Web Server: http://www.progress.co.uk *
* *
************************************************
444444444444444444

 DEC's tar and cpio commands are really just linked to their new "pax"
 program. pax has compatibilty problems. You want to install the
 Obsolete Commands and Utilities subset of the OS to get the old, reliable
 versions of these commands. When you install the OSFOBSOLETE??? subset,
 the binaries will be put into /usr/opt/sterling/usr/bin/.

 --
Carl Privitt / Texas A&M / cprivitt_at_tamu.edu / (409)862-4106 / CIS Unix
Systems

5555555555555555555

You'll probably get more completer rundowns from others, but the basic
isues are:
1) density the tape is written at
2) hardware data compression
3) block size the data is written at
4) byte swapping

Methods to ensure the tapes you write are compatible with other
systems/tape drives include:
1) use the lowest density you can on the writing machine. In Digital
    UNIX, use the tar flag "f /dev/rmt0l", assuming it's the "0" tape
    drive. Thisalso turns compression off.
2) Get a handle on what block size your sysem uses by default. In
    Digital UNIX at least, the "b" flag changes it from the default of 20.
    It seems I have most of my problems with SGI, they use differing block
    sizes, depending, it seems, on the version of IRIX.
3) Once you have all this straightened out, you could still have a byte
    swap problem. In which case, with tar at least, you need to use dd with

    a -conv=swab flag.

There are utilities freely available that will tell you the block size a
tape is written in, the one I use is a simple c language program that I
have compiled on AIX, IRIX & Digital UNIX. Knowing the block size is a
major first step in getting the tape read.

Stan Huhman

666666666666666666

for cpio, (1) use "-c" to read and write header information in ASCII;
allows other systems cpios work, (2) use "-C value" to specify the
read/write record size and communicate this size to the person trying to
read the tape, and (3) never do a rooted cpio unless doing a full backup:
rooted:
  find /usr -print | cpio -ovc -C 32768 -O /dev/rmt0h
non-rooted:
  cd /usr ; find . -print | cpio -ovc -C 32768 -O /dev/rmt0h

SMTP:rioux_at_ip6480nl.ce.utexas.EDU

77777777777777777777

Phil,
The ones I am aware of are simple C programs that someone put together.
I saw one just recently, I think on this list, but I didn't keep it. The
one I use I got from DEC support. It's called simply block. I've
compiled it on DUNIX, IRIX & AIX. I'll include it here:
/*
 * block.c - determine size of blocks read from magnetic tape or networks.
 * Copyright (C) 1985, 1986, 1987, 1991 Robert M. Toxen, Fly-By-Day
 * Consulting, 6 Ruthellen Road, Framingham, MA 01701, 508-877-4991.
 * Permission to use is granted if all of the following are complied with:
 * 1. This copyright is not removed.
 * 2. The program is not altered to prohibit printing out the copyright
 * notice.
 * 3. This program is not sold or bought for any price.
 * 4. No liability by the copyright holder of any kind, including special,
 * puntitive, or consequential is assumed. Use at your own risk. Use
 * of this product constitutes agreement to this lack of liability by
 * the copyright holder. This program is offered "as is".
 *
 * To compile on U*x: cc -o block -O block.c
 * This program has not been tested on 16-bit machines (sizeof (int) == 2).
 * This program assumes 2's compliment arithmetic.
 */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>

#define R register

int dflag; /* display data */
int cflag; /* continue on error */
long block = 32767; /* typical maximum tape record size (sizeof short
 -1)
*/
char *malloc();
char *buf;
char *progname = "block";
FILE *diag = stdout;
int errno;
char *wname;
int wfd = -1;

main(argc, argv)
int argc;
char **argv;
{
        long i;
        long atol();

        if (argc > 0)
                progname = *argv;
        argc--;
        argv++;
        fprintf(stderr, "%s: Copyright (C) 1985, 1986, 1987, 1991 Robert M.
Toxen, 508-877-4991.\n", progname);
        while (argc > 0 && **argv == '-') {
                if (!strcmp(*argv, "-d")) {
                        dflag++;
                        diag = stderr; /* to stderr since data to stdout */
                        fprintf(stderr,
                          "block: data to stdout, messages to stderr\n");
                } else if (!strcmp(*argv, "-b")) {
                        argc--;
                        argv++;
                        i = atol(*argv);
                        if (i < 1)
                                error("non-positive block size '%s'",
*argv);
                        block = i;
                        fprintf(stderr, "block: block size will be %ld\n",
                          block);
                } else if (!strcmp(*argv, "-w")) {
                        argc--;
                        argv++;
                        wname = *argv;
                        wfd = creat(wname, 0600);
                        if (wfd < 0)
                                error("cannot open '%s' for writing",
*argv);
                        fprintf(stderr, "block: writing tape to '%s'\n",
wname);
                } else if (!strcmp(*argv, "-c")) {
                        cflag++;
                        fprintf(stderr, "block: will continue on error\n");
                } else {
                        fprintf(stderr, "block: usage:\n");
                        fprintf(stderr,
"\tblock [-b block_size] [-c] [-d] [-w ofile] [ifile]\n");
                        fprintf(stderr,
                          "-b specifies block size, default %ld\n",
                          block);
                        fprintf(stderr, "-c prevents exit on read error\n");
                        fprintf(stderr,
"-d outputs printf of data to stdout, messages to stderr\n");
                        fprintf(stderr,
                          "-w copies input to file ofile\n");
                        fprintf(stderr,
"if ifile is listed, it is opened for reading, else stdin\n");
                        error("Unknown flag '%c'", **argv);
                }
                argc--;
                argv++;
        }
        if (argc > 1)
                error("too many args");
        if (argc) {
                close(0);
                if (open(*argv, 0) != 0)
                        error("cannot open '%s'", *argv);
        }
        buf = malloc(block+2);
        if (buf == NULL)
                error("cannot malloc %d bytes", block);
        doit();
}

doit()
{
        R long i;
        static long oldi = -2;
        int record;

        record = 0;
        for (;;) {
                for (i=0; i<block+1; i++)
                        buf[i] = '\0';
                errno = 0;
                i = read(0, buf, block);
                if (dflag)
                        printf("read '%.*s'\n", strlen(buf), buf);
                if (i < 0) {
                        fprintf(diag,
                          "read #%d returned %ld, errno=%d\n",
                          record, i, errno);
                        perror("read");
                        sleep(10); /* Slow down, don't skid. */
                } else {
                        if (wfd >= 0) {
                                errno = 0;
                                if (write(wfd, buf, i) != i)
                                        perror("cannot write ofile");
                        }
                        if (!(record % 50) || i != oldi) {
                                fprintf(diag,
                                  "\nread #%d of %d bytes returned %ld\n",
                                  record, block, i);
                                fflush(diag);
                        } else
                                fprintf(diag, ".");
                }
                if (i <= 0)
                        if (i == 0 || !cflag) {
                                if (wfd >= 0)
                                        close(wfd);
                                exit(i);
                        }
                oldi = i;
                record++;
        }
}

error(f, a, b, c)
char *f;
char *a;
char *b;
char *c;
{
        fprintf(stderr, "%s: ", progname);
        fprintf(stderr, f, a, b, c);
        fprintf(stderr, "\n");
        exit(1);
}

 ------------------------- end -------------------------

End of responses.
Received on Thu Aug 01 1996 - 11:31:40 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT