LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 01-27-2006, 06:57 AM   #1
sharonenoch
LQ Newbie
 
Registered: Jan 2006
Location: Chennai, India
Distribution: Fedora Core 3 & 4
Posts: 19

Rep: Reputation: 0
/dev/st0 : Input/Output error


Hi all

I have a tape drive HP Colorado 5GB

I connected it to my linux system having Fedora core 3. boot loader lilo

each time i do a reboot i have to run the command

Code:
modprobe ide-scsi
only then the entry in /dev/sto appears and i am able to access the tape drive

I tried adding the command to rc.local but still no effect

Question 1
********
How do i load this module ide-scsi during boot up? (i dont have a modules.conf in my machine)



Anyway after running that command i am able to use "mt" commands to access the device..

I am able to copy data into the device using the "cpio" command..

but I am not able to copy data into the device using the "tar" command
It gives me input / output error.

I know that cpio and tar uses different formatting. tar used 10240 bytes as block size (default) is what i read from man page.

The block size of the tape drive
when no tape is present is 0 bytes
when tape is present is 512 bytes

So i thought of changing the block size of the tape drive to 0 ( variable block size) using the
Code:
mt setblk 0
or 
mt -f /dev/st0 setblk 0
but this command was giving me the same error
/dev/st0 : Input/Output error

I tried writing a program thereby calling ioctl 's to set the block size but i am getting the same error..

Code:
  struct mtop magtape_ops;
  struct mtget magtape_get;
  int fd;
 
   
   /* Open the tape drive, read-only mode */

  fd = open (tape_drive, O_RDONLY);
  if (fd < 0) {
    perror ("open");
    fprintf (stderr, "unable to open tape drive [%s] for reading\n",
	     tape_drive);
    fprintf (stderr, "did you mistype the tape drive name?\n");
    return(-1);
  }

  /* Get information about the tape drive */

  memset ((struct mtop *) &magtape_ops, 0, sizeof(struct mtop));
  magtape_ops.mt_op = MTNOP;
  magtape_ops.mt_count = 1;
  
  if (ioctl (fd, MTIOCTOP, &magtape_ops) < 0) {
    perror ("ioctl MTIOCTOP:MTNOP");
    fprintf (stderr, "unable to issue a NOOP command to the tape drive");
    fprintf (stderr, " to clear its command buffer.\n");
    return(-1);
  }

  memset ((struct mtget *) &magtape_get, 0, sizeof(struct mtget));
  if (ioctl (fd, MTIOCGET, &magtape_get) < 0) {
    perror ("ioctl MTIOCGET");
    fprintf (stderr, "unable to get tape drive status.\n");
    return(-1);
  }

  /* is there a tape in the drive? */

  if (GMT_DR_OPEN(magtape_get.mt_gstat)) {
    fprintf (stderr, "error: the tape drive appears to be open\n");
    fprintf (stderr, " and/or a tape is not inserted.  Please insert\n");
    fprintf (stderr, " a tape and close the tape drive door.\n");
    return(-1);
  }

  /* is the tape write protected? */

  if (!GMT_WR_PROT(magtape_get.mt_gstat)) {
    fprintf (stderr, "error: tape loaded in drive appears to be NOT\n");
    fprintf (stderr, " write-protected.  Please unload the tape, enable\n");
    fprintf (stderr, " write protection, and reload the tape.\n");
    return(-1);
  }

  /* is the tape drive online? */

  if (!GMT_ONLINE(magtape_get.mt_gstat)) {
    fprintf (stderr, "error: tape drive is not on-line.  Please place\n");
    fprintf (stderr, " the tape drive on-line and rerun this program.\n");
    return(-1);
  }

  /* rewind the tape drive */

  memset ((struct mtop *) &magtape_ops, 0, sizeof(struct mtop));
  magtape_ops.mt_op = MTREW;
  magtape_ops.mt_count = 1;
  
  if (ioctl (fd, MTIOCTOP, &magtape_ops) < 0) {
    perror ("ioctl MTIOCTOP:MTREW");
    fprintf (stderr, "unable to issue a MTREW command to the tape drive");
    fprintf (stderr, " to rewind the tape.\n");
    return(-1);
  }


  memset ((struct mtop *) &magtape_ops, 0, sizeof(struct mtop));
  magtape_ops.mt_op = MTSETBLK;
  magtape_ops.mt_count = 0;

  if (ioctl (fd, MTIOCTOP, &magtape_ops) < 0) 
 {
    perror ("ioctl MTIOCTOP:MTSETBLK");
    fprintf (stderr, "unable to issue a MTSETBLK command to the tape drive");
    fprintf (stderr, " to set the blocksize to variable.\n");
    return(-1);
  }
I am sure that the tape is loaded as i am able to retrieveother data like whether the tape is write protected or not , cpio command works for data backup

Question 2
********
How do i get to set the tape to variable block size?


Since if i am able to set the tape to variable block size i guess everything should work just fine..

Anyone any ideas????? I am not sure this is the correct forum but since it invovled tape drives i put it here

Last edited by sharonenoch; 01-27-2006 at 06:59 AM.
 
Old 02-10-2006, 01:44 PM   #2
thronh
LQ Newbie
 
Registered: Jan 2006
Posts: 9

Rep: Reputation: 0
I was runnning into the same problems with my Quantum LTO-2 drive. I could write to the device and see it but couldnt get any data off the device. I ran dmesg and found out the tape device was erroring out. I had to finally replace the drive and the cable.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cat /dev/ttyS0: Input/output error lionking_x Linux - Hardware 3 01-07-2006 12:16 AM
/dev/hdc : Input/output error tulip4heaven Linux - Software 3 04-27-2005 01:03 PM
input/output dev/hda error meira Red Hat 2 09-01-2004 09:31 AM
Input/Output error during read on /dev/hdb yibble Fedora - Installation 4 05-25-2004 04:57 AM
/dev/hdd input/output error... Linux~Powered Linux - Software 8 02-17-2004 01:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration