I'll add that for the most part the tapealert or sg_read_attr codes you want to use for tape aging are:

0x19 = "Nearing media life"
0x07 = "Media life"

The ones for drive trouble are:

1 Read warning
2 Write warning
3 Hard error
4 Media
5 Read failure
6 Write failure

The above are temporary unless accompanied by "hard" (in which case the tape or drive head may be dead)

13 Recoverable mechanical cartridge failure
14 Unrecoverable mechanical cartridge failure
15 Memory chip in cartridge failure

These are all what they say they are

18 Tape directory corrupted on load

This refers to the directory of file locations in the memory chip (Which bacula doesn't use) and is fixed by recsanning the tape - something the drive usually does automatically.


https://github.com/hreinecke/sg3_utils/issues/18 may be useful for anyone wanting to hack up scripts.


On 07/08/18 12:31, Alan Brown wrote:
On 07/08/18 10:27, Kern Sibbald wrote:
You definitely do not want to try to run any job that examines the tape.  First, I don't know if what you are asking is possible -- possibly on the more modern drives (LTO-6 or greater), but in any case, any time you move the tape, you wear it, so don't make the tape drive move any more than necessary to backup/restore your data.


For LTO, there are a number of relatively easy ways of answering these questions _without_ moving the tape - as long as you have the latest version of sg3_utils installed


"man sg_read_attr"


Here's what's loaded in one of my drives (note that it reports RAW values for remaining and maximum capacity, not marketing values)


Attribute values:
  Remaining capacity in partition [MiB]: 335528
  Maximum capacity in partition [MiB]: 2384185
  TapeAlert flags: 0
  Load count: 5
  MAM space remaining [B]: 2903
  Assigning organization: LTO-CVE
  Format density code: 0x5a
  Initialization count: 1
  Volume change reference: 0x20c
  Density vendor/serial number at last load: IBM 90WT062043
  Density vendor/serial number at load-1: IBM 90WT062043
  Density vendor/serial number at load-2: IBM 10WT008762
  Density vendor/serial number at load-3: IBM 90WT007771
  Total MiB written in medium life: 4471698
  Total MiB read in medium life: 2480
  Total MiB written in current/last load: 1334526
  Total MiB read in current/last load: 40
  Logical position of first encrypted block: <unknown> [ff]
  Logical position of first unencrypted block -
      after first encrypted block: <unknown> [ff]
  Medium manufacturer: FUJIFILM
  Medium serial number: EV40X2M13K
  Medium length [m]: 846
  Medium width [0.1 mm]: 127
  Assigning organization: LTO-CVE
  Medium density code: 0x5a
  Medium manufacture date: 20160429
  MAM capacity [B]: 16384
  Medium type: 0x0
  Medium type information: 0x0
  Barcode: CPL118L6
  Vendor specific device attribute 0xe0a:
 00     3f c4 13 a7 c0 29 73 45  a9 66 cc 0d dd 37 fb 68 ?....)sE.f...7.h
 10     66 fd 34 ee 54 49 0a 53  5b 48 68 39 af f3 45 29 f.4.TI.S[Hh9..E)
 20     72 89 6e 83 14 67 44 46  4b 27 ca 0a c7 70 63 61 r.n..gDFK'...pca
 30     17 ad b2 07 9d 67                                   .....g
  Vendor specific device attribute 0xe0e:
 00     01 0f 00 00 15 91 a4 10 ........
  Vendor specific device attribute 0xe0f:
 00     43 61 72 74 20 70 72 65  73 65 6e 74 20 61 74 20    Cart present at
 10     49 4e 49 54                                         INIT
  Vendor specific device attribute 0xe16:
 00     05 11 01 00 15 91 b4 36 .......6
  Vendor specific device attribute 0xe17:
 00     4f 76 65 72 63 75 72 72  65 6e 74 Overcurrent
  Vendor specific medium attribute 0x1000:
 00     f0 0d af 28 47 36 41 43  41 4c 53 4b 46 55 4a 49 ...(G6ACALSKFUJI
 10     46 49 4c 4d 00 0b 5c cf  00 20 00 00 FILM..\.. ..
  Vendor specific medium attribute 0x1001:
 00     f0 0d af 28 47 36 41 43  41 4c 53 4b 45 56 34 30 ...(G6ACALSKEV40
 10     58 32 4d 31 33 4b 00 20 X2M13K.

Fields 0x1000 and 0x1001 contain encoded data of the actual tape pancake manufacturer and batch number. The format is documented but not (yet) decoded in sg_read_attr.(*)

0xe0[ef] and 0xe1[67] are specific to MPTapes.com "Veritape" and tape cleaning machine respectively (Veritape is resold under a _lot_ of badges, usually at a very high markup over MPT's prices)


If you have a lot of tapes, then a veritape reader is a "very good idea", and a $5000 tape cleaner is cheap insurance considering that a LTO7 tape changer drive is around $10-12,000.

The amount of junk that can come off "new" tapes is surprising - it can clog LTO heads beyond cleaning tape/inbuilt wiper abilities fairly easily, which gets very expensive, very quickly - and even worse it can cross-contaminate other tapes, which then contaminate other drives, as we found out the hard way.


(*) https://www-01.ibm.com/support/docview.wss?uid=ssg1S7003556&aid=1 - page 356      There's even space for Bacula to write back into the atrributes at 0x800-8x821 (page 361)


Best regards,
Kern

On 08/07/2018 09:54 AM, Adam Weremczuk wrote:
On 06/08/18 14:54, Adam Weremczuk wrote:


It would still be useful to have e.g. a daily cron job examining the tape and determining how much raw uncompressed space it has left.

https://wiki.bacula.org/doku.php?id=faq#can_bacula_tell_me_how_much_space_is_left_on_my_tapes

"it's possible to know the raw capacity of each tape and how much data has been stored on each tape"

Unfortunately the author doesn't elaborate on that.

It would be useful to have an advanced warning when one or more parameters determining free raw space reaches a dangerous value (say under 10% left).

Even if the percentage cannot be accurately relied on it's still better then nothing.

I looked into "btape" command but couldn't find the answer.

Has anybody had any success reliably determining raw space left on LTO tapes?

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to