Le Mon, 4 Jan 2016 12:22:34 +0200 (EET) Kai Makisara <Kai.Makisara@xxxxxxxxxxx> écrivait: > >In the HP LTFS sources I found an interesting detail: the code does > >LOAD before unformatting. A comment says that it is in some cases > >better method to put the position to beginning of partition 0 than > >other methods. You could try ‘mt load’ before trying to partition. > > > Here is again a new version of the patch. This does load before > partitioning. The code performing default partitioning (FDP=1) has > also been slightly modified (two more bits of the original mode page > retained). You were right, it works by sending a "LOAD" first: First, not working: # mt -f /dev/nst0 mkpartition 0 Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: Block limits 1 - 16777215 bytes. Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: Mode sense. Length 11, medium 0, WBS 10, BLL 8 Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: Density 5a, tape length: 0, drv buffer: 1 Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: Block size: 0, buffer size: 4096 (1 blocks). Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: Rewinding tape. Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: Partition page length is 16 bytes. Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: PP: max 3, add 1, xdp 1, psum 03, pofmetc 4, rec 03, units 09, sizes: 2543 38 Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: Sending FORMAT MEDIUM Jan 4 12:02:17 shakuhachi kernel: st 7:0:0:0: st0: Error: 8000002, cmd: 4 0 0 0 0 0 Jan 4 12:02:17 shakuhachi kernel: st0: Sense Key : Illegal Request [current] Jan 4 12:02:17 shakuhachi kernel: st0: Add. Sense: Position past beginning of medium Then: # mt -f /dev/nst0 load Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Block limits 1 - 16777215 bytes. Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Mode sense. Length 11, medium 0, WBS 10, BLL 8 Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Density 5a, tape length: 0, drv buffer: 1 Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Block size: 0, buffer size: 4096 (1 blocks). Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Loading tape. Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Block limits 1 - 16777215 bytes. Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Mode sense. Length 11, medium 0, WBS 10, BLL 8 Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Density 5a, tape length: 0, drv buffer: 1 Jan 4 12:02:33 shakuhachi kernel: st 7:0:0:0: st0: Block size: 0, buffer size: 4096 (1 blocks). # mt -f /dev/nst0 mkpartition 0 Jan 4 12:02:42 shakuhachi kernel: st 7:0:0:0: st0: Block limits 1 - 16777215 bytes. Jan 4 12:02:42 shakuhachi kernel: st 7:0:0:0: st0: Mode sense. Length 11, medium 0, WBS 10, BLL 8 Jan 4 12:02:42 shakuhachi kernel: st 7:0:0:0: st0: Density 5a, tape length: 0, drv buffer: 1 Jan 4 12:02:42 shakuhachi kernel: st 7:0:0:0: st0: Block size: 0, buffer size: 4096 (1 blocks). Jan 4 12:02:42 shakuhachi kernel: st 7:0:0:0: st0: Rewinding tape. Jan 4 12:02:42 shakuhachi kernel: st 7:0:0:0: st0: Partition page length is 16 bytes. Jan 4 12:02:42 shakuhachi kernel: st 7:0:0:0: st0: PP: max 3, add 1, xdp 1, psum 03, pofmetc 4, rec 03, units 09, sizes: 2543 38 Jan 4 12:02:42 shakuhachi kernel: st 7:0:0:0: st0: Sending FORMAT MEDIUM # tapeinfo -f /dev/sg6 Product Type: Tape Drive Vendor ID: 'HP ' Product ID: 'Ultrium 6-SCSI ' Revision: '329U' Attached Changer API: No SerialNumber: 'HU1302U4RC' MinBlock: 1 MaxBlock: 16777215 SCSI ID: 0 SCSI LUN: 0 Ready: yes BufferedMode: yes Medium Type: Not Loaded Density Code: 0x5a BlockSize: 0 DataCompEnabled: yes DataCompCapable: yes DataDeCompEnabled: yes CompType: 0x1 DeCompType: 0x1 BOP: yes Block Position: 0 ActivePartition: 0 EarlyWarningSize: 0 NumPartitions: 0 MaxPartitions: 3 -- ------------------------------------------------------------------------ Emmanuel Florac | Direction technique | Intellique | <eflorac@xxxxxxxxxxxxxx> | +33 1 78 94 84 02 ------------------------------------------------------------------------ -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html