Problem with write/read to/from the tape
Posted in 2009
Topics: Versions, Editions & End-of-Life
Hi, I am using IDS 10.0 on RHEL 5.3 platform. I want to do some backup/restore and export/import operation with the database. I am writing a label to the tape as "BACKUP TAPE" or "EXPORT TAPE" during backup/export , so that i can check the same while doing restore/import. I used the below code to write to the tape: //checking the tape if ((fd = open("/dev/st0", O_RDONLY)) >= 0) { printf( "Tape open succeeded\\ "); close(fd); } //Rewinding the tape if( system("mt -f /dev/st0 rewind") != 0 ) { printf( "tape rewind failed\\ "); exit(0); } //Opening the tape in non-rewinding mode if ((fp = fopen("/dev/nst0","w")) == NULL) { printf( "tape open failed\\ "); exit(0); } //writing to tape if((fprintf(fp,"BACKUP TAPE\\ ")<=0) || (ferror(fp)!=0)) printf("write failed\\ "); fclose(fp); To read from the tape: I did the first 3 same operation as in writing and here the code follows if((fgets(cmd,sizeof(cmd)-1,fp)==NULL) || (ferror(fp)!=0) ) { printf("Reading from tape failed\\ "); } printf ("cmd is %s\\ ", cmd); --> prints nothing But write is getting passed without any errors. On the other side, read fails and cud nt read the label Can anyone help me out where i am going wrong? Should i go for tar/cpio to write even a string? -Lakshmi
2009/2/24 POONAM TANDEL <poonam_tandel28@yahoo.co.in>: > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > 8 track or cassette
Keith Simmons wrote: > 2009/2/24 POONAM TANDEL <poonam_tandel28@yahoo.co.in>: >> >> > ******************************************************************************* >> Forum Note: Use "Reply" to post a response in the discussion forum. >> >> > > 8 track or cassette What's wrong with a nice reel-to-reel? -- Cheers, Obnoxio The Clown http://obotheclown.blogspot.com -- This message has been scanned for viruses and dangerous content by OpenProtect(http://www.openprotect.com), and is believed to be clean.
2009/2/24 Obnoxio The Clown <obnoxio@serendipita.com>: > Keith Simmons wrote: >> 2009/2/24 POONAM TANDEL <poonam_tandel28@yahoo.co.in>: >>> >>> >> > ******************************************************************************* >>> Forum Note: Use "Reply" to post a response in the discussion forum. >>> >>> >> >> 8 track or cassette > > What's wrong with a nice reel-to-reel? > > -- > Cheers, > Obnoxio The Clown > > http://obotheclown.blogspot.com > > -- > This message has been scanned for viruses and > dangerous content by OpenProtect(http://www.openprotect.com), and is > believed to be clean. > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > Aahhh !! George 3 and unlimited filestore (provided you could get the operators to load the tapes when needed), none of this foolish compression and tidying to recover disk space. Happy days :-)