
我正在 OpenSuse 15.5 上使用 Quantum DLT-4000 磁带机运行 mt 版本 2.13。
当我运行时,mt -f /dev/st0 status
我得到以下输出:
drive type = 114
drive status = 419430400
sense key error = 0
residue count = 0
file number = 0
block number = 0
如何解释硬盘类型和硬盘状态代码?
答案1
GNUmt
命令产生这些值本质上是直接从ioctlstruct mtget
调用返回的MTIOCGET
。
类型值列于include/uapi/linux/mtio.h
Linux 内核源代码中:
/*
* Constants for mt_type. Not all of these are supported,
* and these are not all of the ones that are supported.
*/
#define MT_ISUNKNOWN 0x01
#define MT_ISQIC02 0x02 /* Generic QIC-02 tape streamer */
#define MT_ISWT5150 0x03 /* Wangtek 5150EQ, QIC-150, QIC-02 */
#define MT_ISARCHIVE_5945L2 0x04 /* Archive 5945L-2, QIC-24, QIC-02? */
#define MT_ISCMSJ500 0x05 /* CMS Jumbo 500 (QIC-02?) */
#define MT_ISTDC3610 0x06 /* Tandberg 6310, QIC-24 */
#define MT_ISARCHIVE_VP60I 0x07 /* Archive VP60i, QIC-02 */
#define MT_ISARCHIVE_2150L 0x08 /* Archive Viper 2150L */
#define MT_ISARCHIVE_2060L 0x09 /* Archive Viper 2060L */
#define MT_ISARCHIVESC499 0x0A /* Archive SC-499 QIC-36 controller */
#define MT_ISQIC02_ALL_FEATURES 0x0F /* Generic QIC-02 with all features */
#define MT_ISWT5099EEN24 0x11 /* Wangtek 5099-een24, 60MB, QIC-24 */
#define MT_ISTEAC_MT2ST 0x12 /* Teac MT-2ST 155mb drive, Teac DC-1 card (Wangtek type) */
#define MT_ISEVEREX_FT40A 0x32 /* Everex FT40A (QIC-40) */
#define MT_ISDDS1 0x51 /* DDS device without partitions */
#define MT_ISDDS2 0x52 /* DDS device with partitions */
#define MT_ISONSTREAM_SC 0x61 /* OnStream SCSI tape drives (SC-x0)
and SCSI emulated (DI, DP, USB) */
#define MT_ISSCSI1 0x71 /* Generic ANSI SCSI-1 tape unit */
#define MT_ISSCSI2 0x72 /* Generic ANSI SCSI-2 tape unit */
/* QIC-40/80/3010/3020 ftape supported drives.
* 20bit vendor ID + 0x800000 (see ftape-vendors.h)
*/
#define MT_ISFTAPE_UNKNOWN 0x800000 /* obsolete */
#define MT_ISFTAPE_FLAG 0x800000
十进制的 114 是十六进制的 0x72,因此该值表示您的磁带驱动器是“通用 ANSI SCSI-2 磁带单元”,这可能是大多数现代磁带驱动器的类型。
状态值是一个位字段,各个位也列在include/uapi/linux/mtio.h
:
/* Generic Mag Tape (device independent) status macros for examining
* mt_gstat -- HP-UX compatible.
* There is room for more generic status bits here, but I don't
* know which of them are reserved. At least three or so should
* be added to make this really useful.
*/
#define GMT_EOF(x) ((x) & 0x80000000)
#define GMT_BOT(x) ((x) & 0x40000000)
#define GMT_EOT(x) ((x) & 0x20000000)
#define GMT_SM(x) ((x) & 0x10000000) /* DDS setmark */
#define GMT_EOD(x) ((x) & 0x08000000) /* DDS EOD */
#define GMT_WR_PROT(x) ((x) & 0x04000000)
/* #define GMT_ ? ((x) & 0x02000000) */
#define GMT_ONLINE(x) ((x) & 0x01000000)
#define GMT_D_6250(x) ((x) & 0x00800000)
#define GMT_D_1600(x) ((x) & 0x00400000)
#define GMT_D_800(x) ((x) & 0x00200000)
/* #define GMT_ ? ((x) & 0x00100000) */
/* #define GMT_ ? ((x) & 0x00080000) */
#define GMT_DR_OPEN(x) ((x) & 0x00040000) /* door open (no tape) */
/* #define GMT_ ? ((x) & 0x00020000) */
#define GMT_IM_REP_EN(x) ((x) & 0x00010000) /* immediate report mode */
#define GMT_CLN(x) ((x) & 0x00008000) /* cleaning requested */
/* 15 generic status bits unused */
状态 419430400 的十六进制值为 0x19000000,因此它是以下各项的总和:
0x10000000
= DDS 设定标记0x08000000
= DDS EOD(数据结束)0x01000000
= GMT_ONLINE(= 已插入磁带并且驱动器已准备好接收命令)
词汇表在最后HP DDS 驱动器技术参考手册将设置标记定义为:
设定标记
分区内的特殊记录元素,驱动器可以快速搜索到该元素,而无需知道设置标记之前的记录或文件标记的数量。
因此,该状态实际上意味着:
- 磁带已插入,驱动器已准备好执行命令
- 当前位置既不是磁带的开头也不是结尾,而是介于两者之间
- 当前位置位于可快速搜索的设置标记处
- 该设置标记专门是数据结束标记,因此磁带上不应再有超过此点的有效数据。
因此,如果您想开始向磁带写入更多数据,那么您就处于正确的位置。