home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / hp / 9431 < prev    next >
Encoding:
Text File  |  1992-08-19  |  2.8 KB  |  80 lines

  1. Newsgroups: comp.sys.hp
  2. Path: sparky!uunet!ukma!darwin.sura.net!Sirius.dfn.de!math.fu-berlin.de!news.th-darmstadt.de!misch
  3. From: misch@rbhp90.rbg.informatik.th-darmstadt.de (Clemens Misch)
  4. Subject: Re: Recovering from disk with bad blocks
  5. Sender: news@news.th-darmstadt.de (The Usenet-News System)
  6. Message-ID: <1992Aug19.133000.23308@news.th-darmstadt.de>
  7. Date: Wed, 19 Aug 1992 13:30:00 GMT
  8. Reply-To: misch@rbhp90.rbg.informatik.th-darmstadt.de
  9. References:  <Bt6ryz.Iq2@knot.ccs.queensu.ca>
  10. Nntp-Posting-Host: rbhp90.rbg.informatik.th-darmstadt.de
  11. Organization: Rechnerbetriebsgruppe FB20; TH Darmstadt (Germany)
  12. Lines: 66
  13.  
  14.  
  15. In article <Bt6ryz.Iq2@knot.ccs.queensu.ca>, heisz@sparky.uucp (Jeff Heisz) writes:
  16. > "What to do when you get this error" the notes for fsck say that if 
  17. > the error is 
  18. > CANNOT READ BLCK ##:
  19. > the diagnositc is:  this never happens.  if it does consult a guru.
  20. > The information on this disk is precious to the nth degree.  It is not
  21. > backuped (of course, else why would I ask you this). Any ideas on
  22. > recovering the info?  It is the SCSI disk for one of HPs and so the 
  23. > OS is HP-UX.
  24.  
  25. In general, you can't recover these block with *standard* HPUX tools.
  26. But if you ar willing to learn a bit about SCSI Commands, and with a
  27. little C-programming you might get some data.
  28. Almost every SCSI Disk supports the READ LONG command. This transfers
  29. a single Block with ECC Bytes.
  30.  
  31. Under HPUX you can send arbitray SCSI Commands with a program like
  32. this. You have to be uid 0 to do this.
  33.  
  34. #include <sys/scsi.h>
  35.  
  36. ....
  37. int on = 1;
  38. int device;
  39.  
  40. struct scsi_cmd_parms command_block;
  41. char buffer[2048];    /* or somet appropriate structure */
  42. union sense_data sense_buffer;
  43. ...
  44.     device = open("/dev/rdsk/0s0",O_RDWR); /* 
  45.  
  46. ...
  47.     ioctl(device,SIOC_CMD_MODE, &on);
  48. ...
  49.     command_block.cmd_type = /* length of SCSI command 6,10,12 */
  50.     command_block.cmd_mode = 1 or 0; /* With ATN or without */
  51.     command_block.clock_ticks = /* timeout in 20 ms ticks */
  52.     command_block.command[i] = /* Your SCSI Command goes here */
  53.  
  54.     ioctl(device,SIOC_SET_CMD, &command_block);
  55.  
  56.     if (read(device, buffer, /*Blocklength to transfer */) == -1 ) {
  57.         ioctl(device, SIOC_XSENSE, sense_buffer);
  58.     }
  59. /* if your SCSI command expects some additional data then use
  60.    a write (instead of read) with this data */
  61.  
  62. .....
  63.  
  64. Something like this appeard sometime ago in this newsgroup. It works
  65. fine for me.
  66.  
  67. I hope this will help you.
  68.  
  69.  
  70. --
  71. ===============================================================================
  72. Clemens Misch                                        Rechnerbetriebsgruppe FB20
  73.                                                      Merckstrasse 25 
  74. EMail: misch@rbhp90.rbg.informatik.th-darmstadt.de   W6100 Darmstadt (Germany)
  75. Tel.: +49 6151 163514
  76. ===============================================================================
  77.