'\" t
.\" Title: tgtimg
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1
.\" Date: 12/08/2018
.\" Manual: [FIXME: manual]
.\" Source: [FIXME: source]
.\" Language: English
.\"
.TH "TGTIMG" "8" "12/08/2018" "[FIXME: source]" "[FIXME: manual]"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
tgtimg \- Linux SCSI Target Framework Image File Utility
.SH "SYNOPSIS"
.HP \w'\fBtgtimg\fR\ 'u
\fBtgtimg\fR [\-o\ \-\-op\ ] [\-Y\ \-\-device\-type\ ] [\-b\ \-\-barcode\ ] [\-s\ \-\-size\ ] [\-t\ \-\-type\ ] [\-f\ \-\-file\ ] [\-T\ \-\-thin\-provisioning]
.HP \w'\fBtgtimg\ \-\-help\fR\ 'u
\fBtgtimg \-\-help\fR
.SH "DESCRIPTION"
.PP
Tgtimg is a utility to create and manage the image files used by the TGTD device emulation\&.
.PP
This command is used to initialize device image files with the additional metadata, such as barcode, list of blocks, total size, etc that the TGTD emulation needs\&.
.SH "OPTIONS"
.PP
\fB\-h, \-\-help\fR
.RS 4
Show a help screen and exit\&.
.RE
.PP
\fB\-o, \-\-op {new|show}\fR
.RS 4
Operation\&. Is either new to create a new image file or show to show the content of an existing image file\&.
.RE
.PP
\fB\-Y, \-\-device\-type \fR
.RS 4
This specifies the type of image file\&.
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
Supported device types are :
cd : to create media for a dvd device
disk : to create media for a disk device
tape : to create media for a tape device
.fi
.if n \{\
.RE
.\}
.PP
\fB\-t, \-\-type \fR
.RS 4
When creating a new image, this specifies the type of media to emulate\&. The available mediatypes depend on the type of the device\&.
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
Supported media types for cd devices are :
dvd+r : create a blank writeable DVD+R disk
Supported media types for disk devices are :
disk : create an empty disk
Supported media types for tape devices are :
data : create a normal data tape
clean : create a cleaning tape
worm : create a worm
.fi
.if n \{\
.RE
.\}
.PP
\fB\-b, \-\-barcode \fR
.RS 4
When creating a new image, this argument specifies the barcode to use with this image file\&. Backup application software often uses barcodes to identify specific tapes\&. When emulating a VTL, make sure that all tape images use unique barcodes\&.
.RE
.PP
\fB\-s, \-\-size \fR
.RS 4
When creating a new image, this specifies the size in megabytes for the virtual tape image\&.
.RE
.PP
\fB\-f, \-\-file \fR
.RS 4
The filename of the image file\&.
.RE
.PP
\fB\-T, \-\-thin\-provisioning\fR
.RS 4
This argument makes the allocation of the image format use thin\-provisioning\&. This means that the file created will be a sparse file that will allocate blocks from the filesystem on demand\&.
.sp
Be careful when using thin\-provisioning\&. If the filesystem fills up a iSCSI write to a thin\-provisioned LUN can fail\&. Initiators generally do not handle "out of space" errors gracefully\&.
.sp
Thin\-provisioning uses FALLOC_FL_PUNCH_HOLE which is only available on some linux filesystems\&. Thin\-provisioning can only be used for DISK images\&.
.RE
.SH "EXAMPLES"
.PP
To create a new 100MByte disk
.sp
.if n \{\
.RS 4
.\}
.nf
tgtimg \-\-op new \-\-device\-type disk \-\-type disk \-\-size 100 \-\-file /data/hd001\&.raw
.fi
.if n \{\
.RE
.\}
.PP
To create a new tape image
.sp
.if n \{\
.RS 4
.\}
.nf
tgtimg \-\-op new \-\-device\-type tape \-\-barcode 12345 \-\-size 100 \-\-type data \-\-file /data/tape001\&.img
.fi
.if n \{\
.RE
.\}
.PP
To view the content of an existing image
.sp
.if n \{\
.RS 4
.\}
.nf
tgtimg \-\-op show \-\-device\-type tape \-\-file /data/tape001\&.img
.fi
.if n \{\
.RE
.\}
.PP
To create a new blank DVD+R image
.sp
.if n \{\
.RS 4
.\}
.nf
tgtimg \-\-op new \-\-device\-type cd \-\-type dvd+r \-\-file /data/dvd001\&.iso
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.PP
tgtd(8), tgtadm(8), tgt\-admin(8), tgt\-setup\-lun(8)\&.
\m[blue]\fB\%http://stgt.sourceforge.net/\fR\m[]
.SH "REPORTING BUGS"
.PP
Report bugs to