pojntfx / stfs

Simple Tape File System (STFS), a file system for tapes and tar files.
GNU Affero General Public License v3.0
45 stars 0 forks source link

Seek/tell relies on scsi2logical option #1

Open immesys opened 1 year ago

immesys commented 1 year ago

This is a really great program. I'm busy getting familiar with it, but I really appreciate the thoughtful UI: serving the tape over FTP server is actually extremely handy for me because I need to back up files from a different machine to the one the tape drive is attached to.

On my drive, however, stfs operation initialize or stfs operation archive panics with input/output error. I traced this down to the fact that seek/tell do not work on the drive (even using the mt command from mt-st package) until I run sudo mt -f /dev/nst0 stsetoptions scsi2logical. This seems to persist until the machine reboots.

Did you hit this at all? I can try adding in the syscall to set this parameter as part of MagneticTapeIO methods? Based on strace, all the mt command boils down to is an MTIOCTOP ioctl. And the flag seems to be defined here so I could probably work out what the full ioctl needs to be.

But I figured I'd ask, because you are likely a lot more familiar with how to do ioctls to tape drives than I am.

pojntfx commented 1 year ago

Hmm, that is a really good point. I'm not sure if adding it as part of the CLI though is the right idea - after all, this isn't something that should be run with every command or every time stfs is run, only once for the setup. How do you feel about me adding it to the documentation instead? I've been working on a similar project that exposes tapes as block devices recently (https://github.com/pojntfx/tapisk) and there I plan on doing the same :)

immesys commented 1 year ago

Yeah, adding something to the docs makes sense as an alternative. Perhaps also the app could catch the error and return an augmented error that says something like "error ... (you might need to enable ... see docs)"

pojntfx commented 1 year ago

That def. sounds like a good idea! I'm sure that we can add a "check" before we mount the FS and exit earlier!