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

"-o eject" fails to mount the tape #212

Closed andi-at-1 closed 4 years ago

andi-at-1 commented 4 years ago

Describe the bug When i try to mount a tape with the -o eject option, the mount fails instantly. When i remove the -o eject option, everything works fine.

see the log:

ltfs -o nonempty -o devname=/dev/sg0 /mnt/ltfs -o eject -o trace
205e LTFS14000I LTFS starting, LTFS version 2.4.2.1 (Prelim), log level 3.
205e LTFS14058I LTFS Format Specification version 2.4.0.
205e LTFS14104I Launched by "ltfs -o nonempty -o devname=/dev/sg0 /mnt/ltfs -o eject -o trace".
205e LTFS14105I This binary is built for Linux (x86_64).
205e LTFS14106I GCC version is 8.3.0.
205e LTFS17087I Kernel version: Linux version 5.4.55-1-pve (root@nora) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP PVE 5.4.55-1 (Mon, 10 Aug 2020 10:26:27 +0200) i386.
205e LTFS17089I Distribution: PRETTY_NAME="Debian GNU/Linux 10 (buster)".
205e LTFS14063I Sync type is "time", Sync time is 300 sec.
205e LTFS17085I Plugin: Loading "sg" tape backend.
205e LTFS17085I Plugin: Loading "unified" iosched backend.
205e LTFS30209I Opening a device through sg-ibmtape driver (/dev/sg0).
205e LTFS30250I Opened SCSI tape device 7.0.0.0 (/dev/sg0).
205e LTFS30207I Vendor ID is HP .
205e LTFS30208I Product ID is Ultrium 5-SCSI .
205e LTFS30214I Firmware revision is Z6ED.
205e LTFS30215I Drive serial is xxx.
205e LTFS30285I Reserved buffer size of /dev/sg0 is 1048576.
205e LTFS12023D Reserving device.
205e LTFS30392D Backend reserve (PRO) xxxx.
205e LTFS12028D Unlocking medium.
205e LTFS30392D Backend allow medium removal xxx.
205e LTFS30392D Backend read block limits xxx.
205e LTFS17160I Maximum device block size is 1048576.
205e LTFS11330I Loading cartridge.
205e LTFS30392D Backend load xxx.
205e LTFS30398D Backend readpos: (0, 0) FM = 0 xxx.
205e LTFS12026D Locking medium in the drive.
205e LTFS30392D Backend prevent medium removal xx.
205e LTFS30398D Backend readpos: (0, 0) FM = 0 xxx.
205e LTFS30392D Backend read block limits xxx.
205e LTFS11332I Load successful.
205e LTFS17157I Changing the drive setting to append-only mode.
205e LTFS30392D Backend load xxxx.
205e LTFS30398D Backend readpos: (0, 0) FM = 0 xxxx.
205e LTFS30201D CDB check condition: sense = 052600, Invalid Field in Parameter List.
205e LTFS30205I MODESELECT (0x55) returns -20500.
205e LTFS30263I MODESELECT returns Invalid Field in Parameter List (-20500) /dev/sg0.
205e LTFS17155E Cannot set WRITE MODE: Mode Select for Device Configuration Extension failed (-20500).
205e LTFS14075E Cannot set up tape drive.
205e LTFS12028D Unlocking medium.
205e LTFS30392D Backend allow medium removal xxxx.
205e LTFS12025D Releasing device.
205e LTFS30392D Backend release (PRO) xxxx.
205e LTFS30393D Backend LBP Enable: 0 .
205e LTFS30393D Backend LBP Method: 1 .
205e LTFS30201D CDB check condition: sense = 052600, Invalid Field in Parameter List.
205e LTFS30205I MODESELECT (0x55) returns -20500.
205e LTFS30263I MODESELECT returns Invalid Field in Parameter List (-20500) /dev/sg0.

I thought the cartrige was bad, but i extensively tested it with the HP tools, everything good. If i mount the device without -o eject it works fine:

ltfs -o nonempty -o devname=/dev/sg0 /mnt/ltfs -o trace
4869 LTFS14000I LTFS starting, LTFS version 2.4.2.1 (Prelim), log level 3.
4869 LTFS14058I LTFS Format Specification version 2.4.0.
4869 LTFS14104I Launched by "ltfs -o nonempty -o devname=/dev/sg0 /mnt/ltfs -o trace".
4869 LTFS14105I This binary is built for Linux (x86_64).
4869 LTFS14106I GCC version is 8.3.0.
4869 LTFS17087I Kernel version: Linux version 5.4.55-1-pve (root@nora) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP PVE 5.4.55-1 (Mon, 10 Aug 2020 10:26:27 +0200) i386.
4869 LTFS17089I Distribution: PRETTY_NAME="Debian GNU/Linux 10 (buster)".
4869 LTFS14063I Sync type is "time", Sync time is 300 sec.
4869 LTFS17085I Plugin: Loading "sg" tape backend.
4869 LTFS17085I Plugin: Loading "unified" iosched backend.
4869 LTFS14095I Set the tape device write-anywhere mode to avoid cartridge ejection.
4869 LTFS30209I Opening a device through sg-ibmtape driver (/dev/sg0).
4869 LTFS30250I Opened SCSI tape device 7.0.0.0 (/dev/sg0).
4869 LTFS30207I Vendor ID is HP .
4869 LTFS30208I Product ID is Ultrium 5-SCSI .
4869 LTFS30214I Firmware revision is Z6ED.
4869 LTFS30215I Drive serial is xxxx.
4869 LTFS30285I Reserved buffer size of /dev/sg0 is 1048576.
4869 LTFS12023D Reserving device.
4869 LTFS30392D Backend reserve (PRO) xxxx.
4869 LTFS12028D Unlocking medium.
4869 LTFS30392D Backend allow medium removal xxxx.
4869 LTFS30392D Backend read block limits xxxx.
4869 LTFS17160I Maximum device block size is 1048576.
4869 LTFS11330I Loading cartridge.
4869 LTFS30392D Backend load xxxx.
4869 LTFS30398D Backend readpos: (0, 0) FM = 0 xxxx.
4869 LTFS12026D Locking medium in the drive.
4869 LTFS30392D Backend prevent medium removal xxxx.
4869 LTFS30398D Backend readpos: (0, 0) FM = 0 xxxx.
4869 LTFS30392D Backend read block limits xxxx.
4869 LTFS11332I Load successful.
4869 LTFS17157I Changing the drive setting to write-anywhere mode.
4869 LTFS11005I Mounting the volume.
4869 LTFS11012D Loading the tape.
4869 LTFS30392D Backend load xxxx.
4869 LTFS30398D Backend readpos: (0, 0) FM = 0 xxxx.
4869 LTFS30398D Backend readpos: (0, 0) FM = 0 xxxx.
4869 LTFS30392D Backend read block limits xxxx.
4869 LTFS30397D Backend locate: (0, 0) xxxx.
4869 LTFS30398D Backend readpos: (0, 0) FM = 0 xxxx.
4869 LTFS11007D Tape is loaded.
4869 LTFS11008D Reading partition labels.
4869 LTFS30392D Backend read block limits xxxx.
4869 LTFS30397D Backend locate: (0, 0) xxxx.
4869 LTFS30398D Backend readpos: (0, 0) FM = 0 xxxx.
4869 LTFS30201D CDB check condition: sense = 000001, Filemark Detected.
4869 LTFS30204D READ (0x08) expected error -20004.
4869 LTFS30219D Read block: file mark detected.
4869 LTFS30201D CDB check condition: sense = 000001, Filemark Detected.
4869 LTFS30204D READ (0x08) expected error -20004.
4869 LTFS30219D Read block: file mark detected.
4869 LTFS30392D Backend read block limits xxxx.
4869 LTFS30397D Backend locate: (1, 0) xxxx.
4869 LTFS30398D Backend readpos: (1, 0) FM = 0 xxxx.
4869 LTFS30201D CDB check condition: sense = 000001, Filemark Detected.
4869 LTFS30204D READ (0x08) expected error -20004.
4869 LTFS30219D Read block: file mark detected.
4869 LTFS30201D CDB check condition: sense = 000001, Filemark Detected.
4869 LTFS30204D READ (0x08) expected error -20004.
4869 LTFS30219D Read block: file mark detected.
4869 LTFS30392D Backend read block limits xxxx.
4869 LTFS11013D Partition labels are valid.
4869 LTFS11014D Reading MAM parameters.
4869 LTFS11339D Read volume lock status (0).
4869 LTFS30201D CDB check condition: sense = 052400, Invalid Field in CDB.
4869 LTFS30205I MODESENSE (0x5a) returns -20501.
4869 LTFS30263I MODESENSE returns Invalid Field in CDB (-20501) /dev/sg0.
4869 LTFS11018D Done reading MAM parameters.
4869 LTFS11019D Checking volume consistency.
4869 LTFS30397D Backend locate: (0, 5) xxxx.
4869 LTFS30398D Backend readpos: (0, 5) FM = 3 xxxx.
4869 LTFS30201D CDB check condition: sense = 000000, No Additional Sense Information.
4869 LTFS30204D READ (0x08) expected error -20000.
4869 LTFS30218D Read block: underrun in illegal length. residual = 521786, actual = 2502.
4869 LTFS30201D CDB check condition: sense = 000001, Filemark Detected.
4869 LTFS30204D READ (0x08) expected error -20004.
4869 LTFS30219D Read block: file mark detected.
4869 LTFS30396D Backend space back file marks: 1 xxxx.
4869 LTFS30398D Backend readpos: (0, 6) FM = 3 xxxx.
4869 LTFS30396D Backend space forward file marks: 1 xxxx.
4869 LTFS30398D Backend readpos: (0, 7) FM = 4 xxxx.
4869 LTFS11025D Volume is consistent.
4869 LTFS11028D Consistency check finished.
4869 LTFS17227I Tape attribute: Vendor = IBM .
4869 LTFS17227I Tape attribute: Application Name = LTFS .
4869 LTFS17227I Tape attribute: Application Version = 2.4.2.1 .
4869 LTFS17227I Tape attribute: Medium Label = .
4869 LTFS17228I Tape attribute: Text Localization ID = 0x81.
4869 LTFS17227I Tape attribute: Barcode = .
4869 LTFS17227I Tape attribute: Application Format Version = 2.4.0 .
4869 LTFS17228I Tape attribute: Volume Lock Status = 0x00.
4869 LTFS17227I Tape attribute: Media Pool name = .
4869 LTFS14111I Initial setup completed successfully.
4869 LTFS14112I Invoke 'mount' command to check the result of final setup.
4869 LTFS14113I Specified mount point is listed if succeeded.

I´m using the latest build of the software, can i post anything else to help you locate that bug?

piste-jp commented 4 years ago

Sorry for my slow response. We had national holidays on Monday and Tuesday on Japan.

Anyway, it looks HP's LTO5 drive doesn't have append-only mode feature. It should be skipped on HP's LTO5 at least.

05e LTFS17157I Changing the drive setting to append-only mode.
205e LTFS30392D Backend load xxxx.
205e LTFS30398D Backend readpos: (0, 0) FM = 0 xxxx.
205e LTFS30201D CDB check condition: sense = 052600, Invalid Field in Parameter List.
205e LTFS30205I MODESELECT (0x55) returns -20500.
205e LTFS30263I MODESELECT returns Invalid Field in Parameter List (-20500) /dev/sg0.
205e LTFS17155E Cannot set WRITE MODE: Mode Select for Device Configuration Extension failed (-20500).

Let me have a time to fix this.