LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Tape Backup - mt erase, dd, and tar overwriting produce input/output error (https://www.linuxquestions.org/questions/linux-newbie-8/tape-backup-mt-erase-dd-and-tar-overwriting-produce-input-output-error-936944/)

sp00led 03-28-2012 03:38 PM

Tape Backup - mt erase, dd, and tar overwriting produce input/output error
 
I've been banging my head on this one all day. I've got a HP 1/8 G2 Autoloader I'm using to write some data to an LTO-4 tape.

I've successfully written the data to the tape using:
tar -czf /dev/st0

and I have extracted the data using:
tar -xzf /dev/st0

I now have two archives on the tape and I can rewind and fast forward to the second track no problem.

I now want to erase or write over what is there for my real backup (other data was just junk for testing). I'm getting the following errors.

root@x:/dev# dd if=/dev/zero of=/dev/nst0
dd: writing to `/dev/nst0': Input/output error
dd: closing output file `/dev/nst0': Input/output error

root@x:/dev# mt -f /dev/st0 erase
/dev/st0: Input/output error

root@x:/dev# mt -f /dev/st0 rewind
root@x:/dev# tar -cf /dev/st0 /home
tar: Removing leading `/' from member names
tar: /dev/st0: Cannot write: Input/output error
tar: Error is not recoverable: exiting now

root@x:/dev# lsscsi -g
[0:0:0:0] * *cd/dvd *TEAC * * DVD-ROM DV-28SW *R.2A */dev/sr0 */dev/sg0
[2:0:32:0] * enclosu DP * * * BACKPLANE * * * *1.07 *- * * * * /dev/sg1
[2:2:0:0] * *disk * *DELL * * PERC H700 * * * *2.0. */dev/sda */dev/sg2
[3:0:0:0] * *tape * *HP * * * Ultrium 4-SCSI * U52W */dev/st0 */dev/sg3
[3:0:0:1] * *mediumx HP * * * 1x8 G2 AUTOLDR * 3.00 */dev/sch0 */dev/sg4

# uname -a
Linux dialga 3.0.0-16-generic-pae #29-Ubuntu SMP Tue Feb 14 13:56:31 UTC 2012 i686 i686 i386 GNU/Linux

Anyone know why I'm getting this?

chrism01 03-28-2012 05:50 PM

Well, according to http://linux.die.net/man/1/tapeinfo
Quote:

One good time to use 'tapeinfo' is immediately after a tape i/o operation has failed. On tape drives that support HP's 'tapealert' API, 'tapeinfo' will report a more exact description of what went wrong.
Worth a try ...

sp00led 03-29-2012 10:57 AM

hey thanks I didn't know about 'tapeinfo'. When i ran it I noticed the following:

TapeAlert[9]: Write Protect: Attempted to write to a write-protected cartridge.

I put a new tape in and the 'mt -f /dev/st0 erase' worked on a brand new tape. The old one is still giving I/O errors due to the WP status. What's weird is I took both out and they were not switched to write protect. I guess the tape is a little flakey but I at least now have one more troubleshooting tool to work with.

Thanks

SaintDanBert 03-29-2012 01:16 PM

The tape has permissions as well as the drive.
If you wrote the tape as user1, then user2 cannot clobber the contents without proper permissions.

I created a 'tape' user and group who "owns" all my tapes.
Then folks who user tape are members of the 'tape' group ...
unless I want to limit the access.

Keep us informed about what you learn.

Still using 4mm tape, too,
~~~ 0;-Dan

sp00led 04-12-2012 12:55 PM

I thought it was maybe related to the physical tape but I just wrote to another HP LTO-4 tape and I have the same results. When it was brand new it took the erase command. Now that there is a tar there it won't let me run the erase.

TapeAlert[9]: Write Protect: Attempted to write to a write-protected cartridge.

Something is write protecting it and it's not the physical switch on the tape.


SaintDanBert, is this what you were talking about? Do I need to change something?

/dev# ll /dev/st0
crw-rw---- 1 root tape 9, 0 2012-04-11 11:45 /dev/st0

SaintDanBert 04-13-2012 11:24 PM

Quote:

Originally Posted by sp00led (Post 4651199)
...
SaintDanBert, is this what you were talking about? Do I need to change something?

/dev# ll /dev/st0
crw-rw---- 1 root tape 9, 0 2012-04-11 11:45 /dev/st0

Is the writing process a member of the "tape" group or the "root" user or both?

I would consider setting "rwx" for both user and group of /dev/st0.

If you look at a tar archive "file" -- whether on disk or on tape
-- there is header details. That header includes the UID and GID
of the process that wrote the archive. For tape, this works in much the same way that the UID+GID works for a file system mount point.
Since tar archives are routinely used for file backup, there are some hoops to make sure that you really want to write over (erase)
a "backup" tape.

My tape drives are offline right now -- in storage while I rehab
my house. If I had access to them, I'd send you exact details.
I used to do this all the time.

~~~ 0;-Dan

sp00led 04-16-2012 10:10 AM

I'm writing the tapes as "root" so I was under the impression that it wasn't a permission issue.

I just tried this:


root# id root
uid=0(root) gid=0(root) groups=0(root)
root# usermod -a -G tape root
root# id root
uid=0(root) gid=0(root) groups=0(root),26(tape)
root# mt -f /dev/st0 erase
/dev/st0: Input/output error

I'm not sure how to get the header details of the tar or to look at the tape in any more detail than:

tar -tzf /dev/st0

sp00led 05-06-2013 11:01 AM

So figured everyone could get a lul from a tape drive noobie. I recently started messing with out tape drive again and discovered I have WORM (write once, read many) tapes.

That would explain the behavior I was getting. Just figured I'd post this in case someone else runs into this and doesn't know what WORM stood for on the tape. HP's don't break down the acronym in small print.

chrism01 05-06-2013 06:46 PM

Well, I would have figured the acronym if I'd seen it... OTOH, I've only seen that applied to optical media (CD/DVD).
Didn't know you could get WORM tapes, although for crucial info eg auditing, its obviously a good idea :)

New_in_linux 04-28-2014 03:03 AM

facing same issue
 
hi guys,

i am also facing the same issue.
http://www.linuxquestions.org/questi...pe-4175502942/

but in my case i am using HP-LTO3.

Please help me its urgent.

thanks in advance...!!!!


All times are GMT -5. The time now is 01:35 PM.