LinearTapeFileSystem / ltfs

Reference implementation of the LTFS format Spec for stand alone tape drive
BSD 3-Clause "New" or "Revised" License
256 stars 77 forks source link

Error during write operation rendered in a read-only cartridge #300

Closed TulioLazarini closed 3 years ago

TulioLazarini commented 3 years ago

Hello everyone,

I was writing some data on a LTO8 cartridge, and during the job an error 6 happened (write error). I suspended the copy job, unmounted the cartridge, and a clean request came to the display. I performed a clean cycle, and when I reinserted the cartridge and tried to mount it again, I've got the following error:

tulio@skynetcore:~$ sudo ltfs -o devname=/dev/sg0 /ltfs
19d25d LTFS14000I LTFS starting, LTFS version 2.4.3.2 (Prelim), log level 2.
19d25d LTFS14058I LTFS Format Specification version 2.4.0.
19d25d LTFS14104I Launched by "ltfs -o devname=/dev/sg0 /ltfs".
19d25d LTFS14105I This binary is built for Linux (x86_64).
19d25d LTFS14106I GCC version is 10.3.0.
19d25d LTFS17087I Kernel version: Linux version 5.11.0-22-generic (buildd@lcy01-amd64-025) (gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, GNU ld (GNU Binutils for Ubuntu) 2.36.1) #23-Ubuntu SMP Thu Jun 17 00:34:23 UTC 2021 i386.
19d25d LTFS17089I Distribution: DISTRIB_ID=Ubuntu.
19d25d LTFS17089I Distribution: NAME="Ubuntu".
19d25d LTFS14063I Sync type is "time", Sync time is 300 sec.
19d25d LTFS17085I Plugin: Loading "sg" tape backend.
19d25d LTFS17085I Plugin: Loading "unified" iosched backend.
19d25d LTFS14095I Set the tape device write-anywhere mode to avoid cartridge ejection.
19d25d LTFS30209I Opening a device through sg-ibmtape driver (/dev/sg0).
19d25d LTFS30250I Opened the SCSI tape device 0.0.0.0 (/dev/sg0).
19d25d LTFS30207I Vendor ID is QUANTUM .
19d25d LTFS30208I Product ID is ULTRIUM-HH8     .
19d25d LTFS30214I Firmware revision is MA71.
19d25d LTFS30215I Drive serial is 10WT083906.
19d25d LTFS30285I The reserved buffer size of /dev/sg0 is 1048576.
19d25d LTFS30294I Setting up timeout values from RSOC.
19d25d LTFS17160I Maximum device block size is 1048576.
19d25d LTFS11330I Loading cartridge.
19d25d LTFS11332I Load successful.
19d25d LTFS17157I Changing the drive setting to write-anywhere mode.
19d25d LTFS11005I Mounting the volume.
19d25d LTFS11333I A cartridge with write-perm error is detected on DP. Seek the newest index (IP Gen = 53, VCR = 197) (DP Gen = 52, VCR = 175) (VCR = 197).
19d25d LTFS17227I Tape attribute: Vendor = IBM     .
19d25d LTFS17227I Tape attribute: Application Name = LTFS                            .
19d25d LTFS17227I Tape attribute: Application Version = 2.4.3.2 .
19d25d LTFS17227I Tape attribute: Medium Label = TL2129.
19d25d LTFS17228I Tape attribute: Text Localization ID = 0x81.
19d25d LTFS17227I Tape attribute: Barcode = TL2129                          .
19d25d LTFS17227I Tape attribute: Application Format Version = 2.4.0           .
19d25d LTFS17228I Tape attribute: Volume Lock Status = 0x04.
19d25d LTFS17227I Tape attribute: Media Pool name = .
19d25d LTFS14019I Medium is write protected. Mounting read-only.
19d25d LTFS14111I Initial setup completed successfully.
19d25d LTFS14112I Invoke 'mount' command to check the result of final setup.
19d25d LTFS14113I Specified mount point is listed if succeeded.

I saw the two lines below: 19d25d LTFS11333I A cartridge with write-perm error is detected on DP. Seek the newest index (IP Gen = 53, VCR = 197) (DP Gen = 52, VCR = 175) (VCR = 197). 19d25d LTFS14019I Medium is write protected. Mounting read-only.

The write error marked the cartrdge, somehow, as 'write-perm' error and now it only mount as read-only. I have tried to run ltfsck on it, to no avail:

tulio@skynetcore:~$ sudo ltfsck /dev/sg0
LTFS16000I Starting ltfsck, LTFS version 2.4.3.2 (Prelim), log level 2.
LTFS16088I Launched by "ltfsck /dev/sg0".
LTFS16089I This binary is built for Linux (x86_64).
LTFS16090I GCC version is 10.3.0.
LTFS17087I Kernel version: Linux version 5.11.0-22-generic (buildd@lcy01-amd64-025) (gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, GNU ld (GNU Binutils for Ubuntu) 2.36.1) #23-Ubuntu SMP Thu Jun 17 00:34:23 UTC 2021 i386.
LTFS17089I Distribution: DISTRIB_ID=Ubuntu.
LTFS17089I Distribution: NAME="Ubuntu".
LTFS17085I Plugin: Loading "sg" tape backend.
LTFS30209I Opening a device through sg-ibmtape driver (/dev/sg0).
LTFS30250I Opened the SCSI tape device 0.0.0.0 (/dev/sg0).
LTFS30207I Vendor ID is QUANTUM .
LTFS30208I Product ID is ULTRIUM-HH8     .
LTFS30214I Firmware revision is MA71.
LTFS30215I Drive serial is 10WT083906.
LTFS30285I The reserved buffer size of /dev/sg0 is 1048576.
LTFS30205I RSOC (0xa3) returns -20601.
LTFS30263I RSOC returns Not Ready to Ready Transition, Medium May Have Changed (-20601) /dev/sg0.
LTFS30294I Setting up timeout values from vendor and device.
LTFS17160I Maximum device block size is 1048576.
LTFS11330I Loading cartridge.
LTFS11332I Load successful.
LTFS17157I Changing the drive setting to write-anywhere mode.
LTFS16014I Checking LTFS file system on '/dev/sg0'.
LTFS16023I LTFS volume information:.
LTFS16024I Volser (bar code) : TL2129.
LTFS16025I Volume UUID     : 35ae22b8-e795-43ef-bd58-92c87e7fc130.
LTFS16026I Format time     : 2021-06-24 12:31:31.995956663 BST.
LTFS16027I Block size      : 524288.
LTFS16028I Compression     : Enabled.
LTFS16029I Index partition : ID = a, SCSI Partition = 0.
LTFS16030I Data partition  : ID = b, SCSI Partition = 1.
**LTFS16111I The recovery process is skipped because of a locked cartridge (4).**
LTFS11005I Mounting the volume.
**LTFS11333I A cartridge with write-perm error is detected on DP. Seek the newest index (IP Gen = 53, VCR = 197) (DP Gen = 52, VCR = 175) (VCR = 197).**
LTFS17227I Tape attribute: Vendor = IBM     .
LTFS17227I Tape attribute: Application Name = LTFS                            .
LTFS17227I Tape attribute: Application Version = 2.4.3.2 .
LTFS17227I Tape attribute: Medium Label = TL2129.
LTFS17228I Tape attribute: Text Localization ID = 0x81.
LTFS17227I Tape attribute: Barcode = TL2129                          .
LTFS17227I Tape attribute: Application Format Version = 2.4.0           .
LTFS17228I Tape attribute: Volume Lock Status = 0x04.
LTFS17227I Tape attribute: Media Pool name = .
**LTFS17265I Skip writing the index because of the volume is mounted as ERROR_TAPE.**
LTFS11034I Volume unmounted successfully.
LTFS16022I Volume is consistent.
LTFS30252I Logical block protection is disabled.

I have noticed the following lines, but I don't know how to proceed: LTFS16111I The recovery process is skipped because of a locked cartridge (4). LTFS11333I A cartridge with write-perm error is detected on DP. Seek the newest index (IP Gen = 53, VCR = 197) (DP Gen = 52, VCR = 175) (VCR = 197).

Any help would be greatly appreciated. Thanks!

TulioLazarini commented 3 years ago

I tried to find any hint at https://www.ibm.com/docs/en/spectrum-archive-sde/2.4.3.0?topic=systems-generic-messages, but the informational messages are not listed there.

piste-jp commented 3 years ago

Tape device is append only device. So tape device doesn't append any data when a medium have a defect which causes permanent write error (write perm). In other words, tape drive couldn't write any data after a defected position.

It indicates there is no chance to recover the tape on LTFS because LTFS tries to append the newest index at the end of final data when the medium has a defect to cause a write perm. So LTFS tries to write the latest index on the other partition when the drive reports a wrote perm (because of the medium reason).

In this case, drive should report a write perm (because of the medium reason) and LTFS wrote the latest index on the index partition successfully and make it read only. It looks LTFS works as designed.

If you believe the medium healthy, you can reuse the medium in the procedure below.

  1. Copy back all files on the medium to another location (where ever disk or another medium)
  2. make force format by mkltfs -d [device] -f
TulioLazarini commented 3 years ago

Thanks for the clarification @piste-jp-ibm. The media is brand new, so I'll try to use it one more time and see what happens, now that I've cleaned the drive.