Linux iSCSI Target (tgt) - Alpine Linux (2024)

The Linux target framework (tgt) is a user space SCSI target framework that supports the iSCSI and iSER transport protocols and that supports multiple methods for accessing block storage. tgt consists of user-space daemon and tools. Being a user space server, it does not require a kernel module to run. In Alpine Linux, the package is called scsi-tgt

Installation

In Alpine, scsi-tgt is split over several packages:

  • scsi-tgt - the tgtd daemon.
  • scsi-tgt-scripts - tgt-admin helper utility. Makes it easier to configure targets via config files.
  • scsi-tgt-doc - documentation, man pages and example configurations.
  • scsi-tgt-openrc - init scripts for runnit tgt as a service.

Only scsi-tgt is required to run the tgt target daemon. A running daemon can be configured with tgtadm command line tool. However, if you want to use configuration files you need the tgt-admin helper tool, which reads the config and emits appropriate tgtadm commands. The tgt-admin tool is written in perl, and so depends on perl being installed, which is why we have it as a separate package.

This guide assumes that you want to configure iSCSI targets via a configuration file, and have it automatically start during boot.

To install scsi-tgt and the utilities to configure tgt:

# apk add scsi-tgt scsi-tgt-scripts

Note: Note that without setting up the configuration file /etc/tgt/targets.conf first, the tgtd daemon will run with an empty configuration

Once you have editited the configuration file, you can activate the service with

# rc-update add tgt-admin# service tgt-admin start

Sample configuration

Here is an example configuration for exporting a local image file as a iSCSI target (virtual SCSI disk):

Contents of /etc/tgt/conf.d/iscsi.conf

# tgt-admin configuration file## By default, tgt-admin looks for its config file in /etc/tgt/targets.conf# Set the driver. If not specified, defaults to "iscsi".default-driver iscsi## Define a target# iSCSI naming convention for iqn format:# https://www.rfc-editor.org/rfc/rfc3721#section-1.1<target iqn.2023-07.net.tnonline.wiki:server.target1> ## General settings controller_tid 1 vendor_id Forza ## iSCSI features HeaderDigest None DataDigest None ErrorRecoveryLevel 2 ## Access control initiator-address 192.168.0.10 incominguser user1 secretpass12 ## iSCSI targets (exports) <backing-store "/media/target/diskimage_1.img"> lun 1 block-size 4096 params thin_provisioning=1 rotation_rate=0 sense_format=1 allow-in-use yes write-cache on scsi_sn 1001 product_id MediaFiles </backing-store></target>

tgt-admin

tgt-admin is a convenience script to configure the running tgtd daemon. It is not needed if you want to manually configure tgtd using the tgtadm tool.

Documentation can be found in the scsi-tgt-doc package (man tgt-admin), but also on upstream's GitHub page

Common tgt-admin commands are:

  • tgt-admin --execute

Load new targets from /etc/tgt/targets.conf. Existing targets won't be updated.

  • tgt-admin --update <value>

Update selected targets. Targets in-use by initiators won't be updated.

  • tgt-admin --show

Query tgtd for running configuration.

  • tgt-admin --pretend

Only print what would be done and not make any changes.

tgt-admin examples

To see the status of the running configuration, use the tgt-admin -s command:

# tgt-admin -sTarget 1: iqn.2023-07.net.tnonline.wiki:server.target1 System information: Driver: iscsi State: ready I_T nexus information: LUN information: LUN: 0 Type: controller SCSI ID: IET 00010000 SCSI SN: beaf10 Size: 0 MB, Block size: 1 Online: Yes Removable media: No Prevent removal: No Readonly: No SWP: No Thin-provisioning: No Backing store type: null Backing store path: None Backing store flags: LUN: 1 Type: disk SCSI ID: IET 00010001 SCSI SN: 1001 Size: 107374 MB, Block size: 4096 Online: Yes Removable media: No Prevent removal: No Readonly: No SWP: No Thin-provisioning: Yes Backing store type: rdwr Backing store path: /media/target/diskimage_1.img Backing store flags: Account information: user1 ACL information: 192.168.0.10

If you want to see that native commands are needed you can use the --verbose option.

Here you can see the the actual commands used when issuing tgt-admin --update ALL --verbose:

Removing target: iqn.2023-07.net.tnonline.wiki:server.target1

tgtadm -C 0 --mode target --op delete --tid=1


Adding target: iqn.2023-07.net.tnonline.wiki:server.target1

tgtadm -C 0 --lld iscsi --op new --mode target --tid 1 -T iqn.2023-07.net.tnonline.wiki:server.target1tgtadm -C 0 --lld iscsi --mode target --op update --tid 1 --name DataDigest --value Nonetgtadm -C 0 --lld iscsi --mode target --op update --tid 1 --name ErrorRecoveryLevel --value 2tgtadm -C 0 --lld iscsi --mode target --op update --tid 1 --name HeaderDigest --value Nonetgtadm -C 0 --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b "/media/target/diskimage_1.img" --blocksize 4096tgtadm -C 0 --lld iscsi --op update --mode logicalunit --tid 1 --lun 1 --params product_id="MediaFiles"tgtadm -C 0 --lld iscsi --op update --mode logicalunit --tid 1 --lun 1 --params "thin_provisioning=1 rotation_rate=0 sense_format=1"tgtadm -C 0 --lld iscsi --op update --mode logicalunit --tid 1 --lun 1 --params scsi_sn="1001"

Write cache is enabled (default) for lun 1.

tgtadm -C 0 --lld iscsi --op update --mode logicalunit --tid 1 --lun 1 --params vendor_id="Forza"tgtadm -C 0 --lld iscsi --mode account --op bind --tid 1 --user=user1tgtadm -C 0 --lld iscsi --op bind --mode target --tid 1 -I 192.168.0.10

Retrieved from ""

Linux iSCSI Target (tgt) - Alpine Linux (2024)
Top Articles
Oviedo Anonib
Update: How Much is Costco Gas in California Today? | CostContessa
Get maximum control with JCB LiveLink | JCB.com
Current Time In Maryland
Renfield Showtimes Near Amc Kent Station 14
Feet.girl01
Food Universe Near Me Circular
Walmart Automotive Number
Abga Gestation Calculator
Opsahl Kostel Funeral Home & Crematory Yankton
Ebony Ts Facials
Lonely Ghost Discount Codes - 20% Off | September 2024
Navicent Human Resources Phone Number
Coolmathgames.comool Math
Missed Connections Dayton Ohio
Cbs Fantasy Trade Values
I Don'T Give A Rat'S Ass: The Meaning And Origin Of This Phrase - Berry Patch Farms
Anchoring in Masonry Structures – Types, Installation, Anchorage Length and Strength
John Chiv Words Worth
Parentvue Stma
AT&T Mission | Cell Phones, Wireless Plans & Accessories | 2409 E Interstate Highway 2, Mission, TX | AT&T Store
Somewhere In Queens Showtimes Near The Maple Theater
Ruc Usmc List
Gas Buddy Prices Near Me Zip Code
Sweeterthanolives
Clayton Grimm Siblings
Alloyed Trident Spear
Emmi Sellers Cheerleader
Vegamovies Marathi
Panic! At The Disco - Spotify Top Songs
Rugged Gentleman Barber Shop Martinsburg Wv
Dramacool Love In Contract
Erfahrungen mit Rheumaklinik Bad Aibling, Reha-Klinik, Bayern
Diminutiv: Definition, Bedeutung und Beispiele
Vernon Autoplex
Rule 34 Supreme Court: Key Insights and Implications
15 Best Things to Do in Tulare, CA - Travel Lens
Crystal Westbrooks Nipple
Target Minute Clinic Hours
Walmart Careers Application Part Time
Dr Roger Rosenstock Delray Beach
Giant Egg Classic Wow
Gregory (Five Nights at Freddy's)
Connie Mason - Book Series In Order
Apartments for rent in Rotterdam
Mybrownhanky Com
4215 Tapper Rd Norton Oh 44203
Online-Shopping bei Temu: Solltest du lieber die Finger davon lassen?
The 7 best games similar to Among Us for Android - Sbenny’s Blog
Ericdoa Ethnicity
Mileage To Walmart
Cb2 South Coast Plaza
Latest Posts
Article information

Author: Fredrick Kertzmann

Last Updated:

Views: 6394

Rating: 4.6 / 5 (46 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Fredrick Kertzmann

Birthday: 2000-04-29

Address: Apt. 203 613 Huels Gateway, Ralphtown, LA 40204

Phone: +2135150832870

Job: Regional Design Producer

Hobby: Nordic skating, Lacemaking, Mountain biking, Rowing, Gardening, Water sports, role-playing games

Introduction: My name is Fredrick Kertzmann, I am a gleaming, encouraging, inexpensive, thankful, tender, quaint, precious person who loves writing and wants to share my knowledge and understanding with you.