From owner-freebsd-scsi@FreeBSD.ORG Mon Oct 10 21:52:43 2005 Return-Path: X-Original-To: freebsd-scsi@freebsd.org Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C7A0516A41F for ; Mon, 10 Oct 2005 21:52:43 +0000 (GMT) (envelope-from roy+dated+1131573155.a512f9@gnomon.org.uk) Received: from darla.gnomon.org.uk (darla.gnomon.org.uk [212.69.37.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3FAE643D46 for ; Mon, 10 Oct 2005 21:52:43 +0000 (GMT) (envelope-from roy+dated+1131573155.a512f9@gnomon.org.uk) Received: from giles.gnomon.org.uk (cpc2-cmbg2-5-0-cust198.cmbg.cable.ntl.com [80.4.124.198]) by darla.gnomon.org.uk (8.13.4/8.13.4) with ESMTP id j9ALqaON042514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Oct 2005 22:52:41 +0100 (BST) (envelope-from roy+dated+1131573155.a512f9@gnomon.org.uk) Received: from giles.gnomon.org.uk (localhost.gnomon.org.uk [127.0.0.1]) by giles.gnomon.org.uk (8.13.2/8.13.0) with ESMTP id j9ALqadO015296 for ; Mon, 10 Oct 2005 22:52:36 +0100 (BST) (envelope-from roy+dated+1131573155.a512f9@giles.gnomon.org.uk) Received: (from roy@localhost) by giles.gnomon.org.uk (8.13.2/8.13.0/Submit) id j9ALqZRx015295 for freebsd-scsi@freebsd.org; Mon, 10 Oct 2005 22:52:35 +0100 (BST) (envelope-from roy+dated+1131573155.a512f9@giles.gnomon.org.uk) Received: by giles.gnomon.org.uk (tmda-sendmail, from uid 559); Mon, 10 Oct 2005 22:52:35 +0100 (BST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17226.58019.311383.858203@giles.gnomon.org.uk> Date: Mon, 10 Oct 2005 22:52:35 +0100 To: freebsd-scsi@freebsd.org X-Mailer: VM 7.19 under Emacs 21.3.1 From: Roy Badami X-Delivery-Agent: TMDA/1.0.3 (Seattle Slew) X-Primary-Address: roy@gnomon.org.uk Received-SPF: pass (darla.gnomon.org.uk: 80.4.124.198 is authenticated by a trusted mechanism) Subject: QIC tapes and simulated double filemarks X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2005 21:52:43 -0000 The man page for sa(2), when talking about the two filemarks that are normally used to signify end-of-tape, and the phantom file mark used by QIC, says the following: The exception to this is that there seems to be a standard (which we follow, but don't understand why) that certain types of tape do not actually write two file marks to tape, but when read, report a `phantom' file mark when the last file is read. These devices include the QIC family of devices. (It might be that this set of devices is the same set as that of fixed block devices. This has not been determined yet, and they are treated as separate behaviors by the driver at this time.) I don't know whether this mystery has long since been resolved, but I thought I'd post an explanation for the benefit of those too young to remember 9-track tapes and QIC-24/QIC-150 from the first time round. Back in the Old Days, people used 9-track tapes; half-inch tape on open reals. These systems really did support variable block sizes; the logical blocks you wrote *were* the physical blocks on the tape, and these could vary in size. The convention to signify end-of-tape was to write two filemarks. If you later wanted to append to the tape, you would position the tape between the filemarks and start writing. However 9-track tape drives were also rather expensive, and with the advent of the workstation market there was a need for a more affordable tape technology. (Remember, back in those days, tape was the standard interchange format, and also the OS install media. Workstations of that era could boot from tape.) Back then, DEC were using TK50 tapes, HP were using a propriety quarter inch cartridge, and Sun and pretty much everyone else used QIC-24 and subsequently QIC-150. QIC-24 was designed to be a low cost tape medium, and a number of compromises were made in the design to eliminate unnecessary features to keep the cost down. One was the elimination of variable block sizes; the QIC-24 and QIC-150 drives only supported a fixed block size, which simplied the logic in the drive. Another was the use of a full width erase head. QIC-24 and QIC-150 drives use serpentine recording, with the read and write heads moved over the appropriate track by a stepper motor. However the ease head is a fixed head that spans the entire width of the tape, and is only energised when writing to track 1. This is fine for sequential writing, of course, because by the time you start writing to track 2 you've traversed the entire tape, hence ensuring that track 2 and all subsequent tracks have been erased before they are written to. However, this means that the drive can't support overwriting from an arbitrary position on the tape; unless you were positioned on track 1, the erase head wouldn't be energised and hence the data would be written on tape that hadn't been erased, and would be garbled. As a result, QIC-24 and QIC-150 drives essentially only support writing to the tape when the tape is positioned either at BOM or EOD. Essentially you can overwrite an entire tape, or you can append to the end of the tape; you can't do anything else. >From the above, the origin of the phantom filemark should be reasonably obvious. QIC-24/QIC-150 tapes couldn't usefully use two filemarks on the tape to signify EOT. There's no fundamental problem with writing two filemarks, it's just that you'd never be able to overwrite the second one if you wanted to append to the tape. You'd have to append with the tape positioned at EOD (ie after the second filemark) so you'd be left with a tape with a double filemark embedded in the middle. As to whether fixed block size and phantom filemarks are intrinsically linked; I don't think so. Phantom filemarks, if anything, are linked to the inability to write unless you're positioned at wither BOM or EOD. However, the next workstation tape technology that came along was the Exabyte 8mm tape, essentially Video 8, which lacked the overwrite restrictions of QIC (not being serpentine) and although retaining a fixed physical blocksize, simulated variable block sizes in firmware by separating the logical and physical tape structures. I think pretty much all mainstream tape technologies since have adopted a similar approach. Hence whilst there's no fundamental connection between fixed block size and phantom filemarks, QIC-24 and QIC-150 are probably the only mainstream tape formats that had these properties. Hope this is of interest to someone; and apologies if this is all common knowledge to everyone reading this list... -roy