LinearTapeFileSystem / LinearTapeFileSystem/ltfs
ltfs file backend does not work with a format and type different from LTO5
@madjesc is already working on this.
Since Jul 31, 2025.
- Dominant language
- C
- Stars
- 352
- Forks
- 110
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 2
Description
**Describe the bug**
Even tho you can change the tape type and density using `cart_type` and `density_code`, if you use any other format besides LTO5 it will not format.
**To Reproduce**
- `mkdir tape`
- `mkltfs -e file -d tape`
- `cd tape`
- Change the backend configuration to use any density and type different from LTO5, e.g.
```xml
false
false
204800
L6
5A
None
40
2000000
10000
0
```
- `mkltfs -f -e file -d tape`
```
LTFS15000I Starting mkltfs, LTFS version 2.5.0.0 (Prelim), log level 3.
LTFS15041I Launched by "mkltfs -f -t -e file -d tape0".
LTFS15042I This binary is built for Linux (x86_64).
LTFS15043I GCC version is 11.4.1 20231218 (Red Hat 11.4.1-3).
LTFS17087I Kernel version: Linux version 5.14.0-427.13.1.el9_4.x86_64 (mockbuild@x86-038.build.eng.bos.redhat.com) (gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3), GNU ld version 2.35.2-43.el9) #1 SMP PREEMPT_DYNAMIC Wed Apr 10 10:29:16 EDT 2024 i386.
LTFS17089I Distribution: NAME="Red Hat Enterprise Linux".
LTFS17089I Distribution: Red Hat Enterprise Linux release 9.4 (Plow).
LTFS17089I Distribution: Red Hat Enterprise Linux release 9.4 (Plow).
LTFS15025D Validating command line options.
LTFS15037D Command line options are valid.
LTFS15003I Formatting device 'tape0'.
LTFS15004I LTFS volume blocksize: 524288.
LTFS15005I Index partition placement policy: None.
LTFS11337I Update index-dirty flag (1) - NO_BARCODE (0x0x55738f543c50).
LTFS15006D Opening the device.
LTFS17085I Plugin: Loading "file" tape backend.
LTFS30000I Opening a device through generic file driver (tape0).
LTFS30003I Opening a directory through generic file driver (tape0).
LTFS12023D Reserving device.
LTFS12028D Unlocking medium.
LTFS30061E Cannot unlock medium: unit not ready.
LTFS17160I Maximum device block size is 4194304.
LTFS11330I Loading cartridge.
LTFS30048I Loading a directory through generic file driver (tape0).
LTFS30086I Cartridge is unsupported (LTO5, 0x68).
LTFS11331E Failed to load the cartridge (ltfs_load_tape).
LTFS17157I Changing the drive setting to write-anywhere mode.
LTFS15007D Device opened.
LTFS15049I Checking the medium (load).
LTFS30198D Backend readpos: (0, 0) FM = 0.
LTFS15010I Creating data partition b on SCSI partition 1.
LTFS15011I Creating index partition a on SCSI partition 0.
LTFS17254E This cartridge cannot be reformatted in the drive (0x68, 5).
LTFS15012E Failed to format the medium.
LTFS12028D Unlocking medium.
LTFS12025D Releasing device.
LTFS15023I Formatting failed.
```
**Expected behavior**
It should format to any other format available
**Desktop (please complete the following information):**
- OS: RHEL 9.4
**Additional context**
The reason is becase it's hardcoded in `filedebug_tc.c:411`
```c
state->product_id = "ULTRIUM-TD5";
```
But also it tries to get the drive_type from the serial of the tape wich is weird.
```c
for (i = 0; i < (int)strlen(state->serial_number); i++) {
if (state->serial_number[i] == '.') {
state->serial_number[i] = '\0';
state->product_id = &(state->serial_number[i+1]);
break;
}
}
```
In this part gets the first compatible drive from the `ibm_supported_drives` variable, wich is an `ULT3580-TD5` that is not compatible with any other tape.
```c
while(*d_cur) {
if((! strncmp(IBM_VENDOR_ID, (*d_cur)->vendor_id, strlen((*d_cur)->vendor_id)) ) &&
(! strncmp(state->product_id, (*d_cur)->product_id, strlen((*d_cur)->product_id)) ) ) {
state->drive_type = (*d_cur)->drive_type;
break;
}
d_cur++;
}
```
---
I'm currently working in a new option for the xml file to specify the drive type
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.