[stgt] RFC Modify tgtimg to create DISK and CDR media files as well

ronnie sahlberg ronniesahlberg at gmail.com
Thu Apr 1 09:23:37 CEST 2010

List, Tomo,

Tgtimg is a neat tool that currently is used to create TAPE devices.

I think it would be nice from a user viewpoint to use tgtimg to create
the device files for all type of devices,
including SBC DISK and MMC CDR blank disks.

This would I think making a higher level mgmt tool easier since it
could then use the same command, but different flags, to create the
device image file for any kind of device.
This would also make the tgtimg manpage a natural place to describe
how to create the various types of disk image files, instead of
describing using dd to create a DISK in a readme or using touch to
create an empty file for CDR.
This would also provide a first step towards creating a unified
handling of device image metadata such as barcode, unit serial number.
Tgtimg could then become the tool to use to both create all device
image files and also to view/modify the device metadata of it.

Some smaller changes would be required though.
TAPE devices now store all its metadata in the file head.
This would not work for ISO images or DISK images since they are a raw
byte by byte copy of the device they represent and there is no space
for such a header in the file itself, without making them no longer a
byte by byte copy. I think DISK and ISO images being a byte by byte
copy is very valuable since these are standard formats to represent
these types of devices and I dont think it would be worth breaking
interoperability with other tools (or just dd a tgtd disk image onto a
real disk).

So, my suggestion would is
1, enhance tgtimg to allow it to create DISK and CDR images too.
2, use XATTR to store things like barcode, so we can store a barcode
for the CDR disks we create too.
As a special case, write the barcode for TAPE devices to the file
header too, just like today. This guarantees backward compatibility
with older versions of tgtd.
3,enhance tgtd to read the barcode from XATTR for all device types.
As a special case, if no XATTR barcode was found, tape devices would
instead read the barcode from the file header.

second step
4, Start storing things such as ID and SN also in XATTR.  I think
these types of metadata should preferably be stored with the image
file itself and be closely associated with it.


ronnie sahlberg
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list