scanlogd

package: scanlogd

title: scanlogd(8)

summary: detects and logs TCP port scans

text:
# scanlogd(8)

## NAME
scanlogd - detects and logs TCP port scans

## SYNOPSIS
scanlogd

## DESCRIPTION
scanlogd detects port scans and writes one line per scan via the syslog(3) mechanism. If a source address sends multiple packets to different ports in a short time, the event will be logged. The format of the messages is:

saddr[:sport] to daddr [and others,] ports port[, port...], ..., flags[, TOS TOS][, TTL TTL] @HH:MM:SS

The fields in square brackets are optional; sport, TOS, and TTL will only be displayed if they were constant during the scan.

The flags field represents TCP control bits seen in packets coming to the system from the address of the scan. It is a combination of eight characters, with each corresponding to one of the six defined and two reserved TCP control bits (see RFC 793). Control bits that were always set are encoded with an uppercase letter, and a lowercase letter is used if the bit was always clear. A question mark is used to indicate bits that changed from packet to packet.

## INTERFACES
In order to do its job, scanlogd needs a way to obtain raw IP packets that either come to the system scanlogd is running on, or travel across a network segment that is directly connected to the system. Current versions of scanlogd can be built with support for one of several packet capture interfaces.

scanlogd is aware of the raw socket interface on Linux, libnids, and libpcap.

The use of libpcap alone is discouraged. If you're on a system other than Linux and/or want to monitor the traffic of an entire network at once, you should be using libnids in order to handle fragmented IP packets.

## COMPILE-TIME DEFAULTS
At least 7 different privileged or 21 non-privileged ports, or a weighted combination of those, have to be accessed with no longer than 3 seconds between the accesses to be treated as a scan. If more than 5 scans are detected within 20 seconds, that event will be logged and logging will be stopped temporarily.

Logging is done with a facility of daemon and a priority level alert.

scanlogd should be started as root since it needs access to a packet capture interface. By default, it chroots to /var/empty and switches to running as user scanlogd after the packet capture interface is initialized.

## EXIT STATUS
If the daemon couldn't start up successfully, it will exit with a status of 1.

## USAGE
You're expected to create a dummy user for scanlogd to run as. Make sure you allocate unique UID and GID to the user.

In most cases, scanlogd should be started from a rc.d script on system startup.

In /etc/syslog.conf you may use something like:

daemon.alert /var/log/alert

## SECURITY NOTES
As the name indicates, scanlogd only logs port scans. It does not prevent them. You will only receive summarized information in the system's log.

Obviously, the source address of port scans can be spoofed. Don't take any action against the source of attacks unless other evidence is available. Sometimes IP addresses are shared between many people; this is the case for ISP shell servers, dynamic dialup pools, and corporate networks behind NAT (masquerading).

## BUGS
Due to the nature of port scans, both false positives (detecting a scan when there isn't one) and false negatives (not detecting a scan when there's one) are possible. In particular, false positives occur when many small files are transferred rapidly with passive mode FTP.

## AUTHORS

```
Solar Designer <solar at openwall.com>
```

Steffen Dettmer <steffen at dett.de> wrote the initial version of this manual page.

## SEE ALSO
syslog(3), syslog.conf(5), libnids(3), pcap(3)

```
scanlogd home page: http://www.openwall.com/scanlogd/
Phrack Magazine, issue 53, article 13
```


schedtool

package: schedtool

title: schedtool(8)

summary: query and set CPU scheduling parameters

text:
# schedtool(8)

## NAME
schedtool - query and set CPU scheduling parameters

## SYNOPSIS
schedtool

```
[-0|-N] [-1|-F] [-2|-R] [-3|-B] [-4|-I] [-5|-D]
[-M policy]
[-a affinity]
[-p prio]
[-n nice_level]
[-e command [arg ...]]
[-r]
[-v]
[-h]
[LIST OF PIDs]
```

## DESCRIPTION
schedtool can set all CPU scheduling parameters Linux is capable of or display information for given processes.

Long-running, non-interactive tasks may benefit from SCHED_BATCH as timeslices are longer, less system-time is wasted by computing the next runnable process and the caches stay stable.

Audio/video or other near-realtime applications may run with less skipping if set to SCHED_RR. Use the static priority-switch -p to designate inter-process-hierarchies.

schedtool now supports setting the CPU-affinity introduced in linux 2.5.8.

## OPTIONS
-N or -0

set all PIDs to SCHED_NORMAL/OTHER

-F or -1

to SCHED_FIFO root-credentials required

-R or -2

to SCHED_RR root-credentials required

-B or -3

to SCHED_BATCH

-I or -4

to SCHED_ISO

-D or -5

to SCHED_IDLEPRIO

-M policy

for manual/raw mode; policy is the number of the scheduling policy (see above for 0-4). This option is mostly for kernel guys that want to test their new implementations.

-p prio

specify static priority required for SCHED_FIFO and SCHED_RR. Usually ranged from 1-99.

-a affinity

set the PID's affinity to this bitmask (hexadecimal); alternatively, a list mode is supported.

-n nice_level

set the PID's nice level; see nice(2), nice(1).

-e command [arg ...]

execute command with given scheduling parameters (overwrites schedtool's process image). See EXAMPLES.

-r

display min and max priority for each policy.

-v

be verbose.

-h

help

## EXAMPLES
To query the $SHELL's policies:

```
    #> schedtool $$
To query some PIDs, namely 1 2 and 3:
```

```
    #> schedtool 1 2 3
```

To execute mplayer in SCHED_RR with priority 20. The priority arg is needed for both SCHED_RR and SCHED_FIFO.

```
    #> schedtool -R -p 20 -e mplayer -quiet some_file.avi
```

To set current shell to SCHED_BATCH, which all programs the shell starts will inherit:

```
    #> schedtool -3 $$
```

To set all processes with the name 'cpu_hog' to SCHED_BATCH:

```
    #> schedtool -3 `pidof cpu_hog`
```

To set a process' affinity to only the first CPU (CPU0):

```
    #> schedtool -a 0x1 <PID>
Using the list mode and affinty of CPU0 and CPU3:
```

```
    #> schedtool -a 0,3 <PID>
```

A combination of an affinity and a policy-argument is - of course - always possible.

```
   #> schedtool -B -a 0x1 <PID>
```

## AFFINITY MASK
The affinity-argument determines on which CPUs a process is allowed to run. It consists of a simple bitmask represented in hexadecimal. CPU0 is denoted by the least-significant bit, CPU1 by the second least-significant and so on, thus giving:

0x1 -> only run on CPU0

0x2 -> only run on CPU1

0x4 -> only run on CPU2

0x8 -> only run on CPU3 ... and so on.

Multi-target CPUs may be specified using bitwise OR of the values:

0x7 -> run on CPUs 0, 1, 2 but NOT on 4

0x3 -> run only on CPUs 0 and 1

The default is to run a process on all CPUs, giving a mask of

0xf for all 4 CPUs

0xff for all 8 CPUs

## AFFINITY MASK - LIST MODE
Alternatively a list mode is supported where you can specify the CPUs delimited by ",". The following runs <PID> on CPU0 and CPU1 (equivalent to 0x3):

```
   #> schedtool -a 0,1 <PID>
```

## POLICY OVERVIEW
SCHED_NORMAL / SCHED_OTHER This is the default policy and for the average program with some interaction. Does preemption of other processes.

SCHED_FIFO First-In, First Out Scheduler, used only for real-time contraints. Processes in this class are usually not preempted by others, they need to free themselves from the CPU via sched_yield() and as such you need special designed applications. Use with extreme care. ROOT-credentials required.

SCHED_RR Round-Robin Scheduler, also used for real-time constraints. CPU-time is assigned in an round-robin fashion with a much smaller timeslice than with SCHED_NORMAL and processes in this group are favoured over SCHED_NORMAL. Usable for audio/video applications near peak rate of the system. ROOT-credentials required.

SCHED_BATCH [ since 2.6.16 in mainline ] SCHED_BATCH was designed for non-interactive, CPU-bound applications. It uses longer timeslices (to better exploit the cache), but can be interrupted anytime by other processes in other classes to guaratee interaction of the system. Processes in this class are selected last but may result in a considerable speed-up (up to 300%). No interactive boosting is done.

SCHED_ISO [ patch needed ] SCHED_ISO was designed to give users a SCHED_RR-similar class. To quote Con Kolivas: "This is a non-expiring scheduler policy designed to guarantee a timeslice within a reasonable latency while preventing starvation. Good for gaming, video at the limits of hardware, video capture etc."

SCHED_IDLEPRIO [ patch needed ] SCHED_IDLEPRIO is similar to SCHED_BATCH, but was explicitely designed to consume only the time the CPU is idle. No interactive boosting is done. If you used SCHED_BATCH in the -ck kernels this is what you want since 2.6.16

## HINTS
PID 0 means "current process", in our case, schedtool. May occur when using the -e switch.

Be careful with SCHED_FIFO! You may lock out other processes from the CPU, including your shell.

For SCHED_BATCH you certainly need the a recent 2.6 kernel.

A short overview is given in SCHED_DESIGN and the README contains thourough discussion. The INSTALL file also lists all prerequisites and where you can get patches.

Affinity 0x0 should never be used.

## SEE ALSO
sched_setscheduler(2), sched_setaffinity(2), nice(2), nice(1), renice(3).

## BUGS
You need some knowledge about the kernel and scheduling. The author is a grumpy little elitist.

## AUTHOR
Freek

Please contact me via freshmeat.net's "contact author"-feature (http://freshmeat.net/projects/schedtool).

branch: sisyphus


sformat

package: schilytools

title: sformat(8)

text:
# sformat(8)

## NAME
sformat - SCSI disk formatting/partitioning/analysis/repair utility

## SYNOPSIS
sformat [options] target lun [scsibus]

sformat [options]

The first form will select the named disk directly. Have a look at the chapter about Following The Main Thread for more details.

The second form will scan all SCSI busses and enter a selection menu. Have a look at the chapter about The SCSI Selection Menu for more details.

Sformat will never destroy or modify any data unless explicitly confirmed just before the (possibly) destructive action. Have a look at the chapter about How To Answer Questions first.

## DESCRIPTION
Sformat is the first SCSI disk formatting utility that runs under SunOS. Long before Sun decided that formatting and partitioning a disk from a stand alone program is less convenient than doing this job from a running UNIX, sformat has been available.

Sformat leads the beginner through a thread menu and allows the experienced user to do more things than he could do with other disk maintenance programs. All partitioning jobs can be done without the need for a desk calculator.

If you want to do more than simple things, you should carefully read the whole manual. It contains many tips and tricks that will help you to recover disks that would have to be sent back to the manufacturer for repair otherwise. Sformat includes the competence of more than ten years in disk handling and will be able to repair more disks than other disk maintenance programs. Sformat offers special maintenance tests to find the reason for complex disk failures.

## Disk Database Entries
Be nice to other users of sformat. Create database (sformat.dat) entries for disks that are not in the data base using the -Proto flag and mail them to the author. This helps other users and you too. See section on Creating Disk Database Entries below.

## OPTIONS
-help, -h

Print a summary of the most important options for sformat.

-xhelp

Print a summary of less frequently used options for sformat.

-version

Prints the sformat version number string and exists.

-ask

Ask again at certain critical sections. This will currently prompt before modifying the disk when in repair mode.

-auto, -a

autoformat mode (for production systems). When this option is in effect, sformat will not ask whether to modify the format and partition parameters and will only format disks that are known in the data base. There will be only one question to answer. This will immediately start the formatting process. The -auto option enables certain additional verification that will guarantee that the disks have a known firmware release and will inform the user that the disk is bad if certain quality tests failed. The disk will not be formatted if the signature code in the data base is bad. This option has not been verified during the last three years. If you need this mode ask the author for additional verification of the code.

Cveri=#, C=#

Number of blocks/verify. Sformat normally will try to verify 1000 sectors with one SCSI command. Some old disk firmware may not able to deal with a number that will imply to read a number of sectors that will not fit in the local memory of the disk.

CWveri=#, CW=#

Number of blocks/write-verify. The limitation noted with the Cveri option applies here again and even on newer disks.

data=name

Name of disk database file (default: 'sformat.dat'). Use this option to force sformat to use a different disk database than the default. In any case, sformat will search in the current directory first. If no file of the appropriate name was found in the current directory, sformat looks in the following path:

/opt schily/etc, /etc, /usr/etc.

debug=#, -d

Set the misc debug value to # (with debug=#) or increment the misc debug level by one (with -d). If you specify -dd, this equals to debug=2.

kdebug=#, kd=#

Tell the scg-driver to modify the kernel debug value while SCSI commands are running.

xdebug=#, xd=#

Set the debug level for the parser of the external disk database.

-defmodes

Get default mode parameters from disk. Normally sformat retrieves the default modes parameters from the disk by default when the disk is unformatted or has no sun label and the current mode parameter if the disk has a valid sun label. This option tells sformat retrieve the default mode parameters in any case.

-dmdl

Do not use manufacturer defect list when formatting a disk. This implies that a disk that is formatted with this option will have bad blocks. However some disks that may not be formatted because the manufacturer defect list is broken may become usable again when this option is in effect.

ESDI=#

Pass ESDI command # to the drive and print the result. This will only work if an EMULEX MD21 SCSI/ESDI bridge controller is present.

-force

Force to continue at certain errors. This will currently prompt after the format command fails.

-greassign

Reassign blocks. This is the guru mode, don't use this. Read the description for the -reassign option for more details. This option will simply prompt for block numbers and then reassign them regardless of if they need to be reassigned or not. On some disks the block may seem to be defective even after reassigning it because the old data is copied to the new location without recomputing the CRC. On other disk the old data will be lost. These problems will not arise if you use the -reassign option instead.

-ign_not_found

Ignore record not found errors while verifying the disk. This option is useful when trying to repair disks with many defects (see maxbad option). Some disk errors may cause the whole track to appear bad. If the reported error in these cases is record not found, You should first try to repair as many blocks as possible with this option in effect and then repair the remaining blocks without this option.

-inq

Retrieve and print SCSI inquiry data for any type of device. This is useful even on tape drives and scanners.

maxbad=#

When sformat is doing a surface analysis after formatting the disk, it collects a number of bad blocks (usually up to 1023), then reassigns them and then reformats the disk to guarantee that the disk speed will not be reduced by mapped bad blocks. Some disks with many defective blocks will seem to have more defective blocks than they really have, but these false defective blocks need not to be reassigned. This case may be triggered if a defective block directly follows the index. In this case the whole track seems to be bad. If you tell sformat to reformat the disk after repairing one bad block (maxbad=1), this problem will go away.

-modes

Interactive modesense/modeselect. Each mode page exists in 4 versions:

default (PROM), current (RAM), saved (DISK) and changeable (BITMASK).

You may currently view any page if you specify the page number. This is currently under construction.

-noformat

Force not to format disk even when formatting of the disk has been confirmed. This option may be used to modify mode parameters without formatting the disk.

-nomap

Do not map SCSI address to logical disk name. WARNING: If you use this option, sformat is not able to check whether the disk has mounted partitions. This may damage mounted file systems.

-noparity

Try to disable parity checking on all SCSI commands that are sent by sformat. This may not be possible in all implementations of the scg-driver.

-nowait

Do not wait after formatting the disk. Normally, sformat will prompt for a modification of the disk label and partition table before starting to verify the disk. If this option is in effect, sformat will immediately start to verify the disk after formatting.

-no_defaults

Do not set heuristic defaults. If this option is in effect, all disk parameters must be either retrievable from disk or, if not available, provided by the user.

-prdefect

Get and print defect data. This may be used to print the manufacturer and grown defect list that is stored on the disk.

-prgeom

Get and print geometry data. This is an old option but it is useful to get all mode pages that are supported by this disk.

-prcurgeom

Get and print geometry data. This is basically the same as -prgeom except that -prgeom will obtain the default mode pages, -prcurgeom will report the current values.

-Proto

This option will cause sformat to generate a data base entry for the current disk. Make sure that this data base entry will be generated with the correct format time. Sformat is able to compute a format time from the disk geometry, but newer disks seem to need more time than computed. If the format time is too short, the formatting may be aborted and the disk will not be accessible until formatted again completely.

-r

reformat only mode (gives less messages on label menu)

-randv

The random verify test is a method to find problems that may be a result of first seeking to a new place on disk as it is frequently done by the unix file system. This is usually caused by an inode or super block update. The above problems may be a result of bad bearings in the disk. This is a test that is less harmfull to the disk than the -randrw test that writes to the disk. The test may be interrupted via ^C.

-randrw The random read/write test is a method to find problems that may be a result of first seeking to a new place on disk and then writing data to it as it is frequently done by the unix file system. This is usually caused by an inode or super block update. The above problems may be a result of bad bearings in the disk. If the disk does not produce errors while this test is running, there will no harm to the data on disk. However, if you assume that the disk is bad, the data on disk may get corrupted. To minimize the risk of data loss, the first block containing the disk label (partition) and the last block containing the sinfo data (a sformat specific area) will never be written to.

The test may be interrupted via ^C.

-reassign Reassign a list of blocks sformat will prompt for. This is the preferred command when trying to repair a block or a list of blocks with already known block addresses. If you don't know the address of a defective block, use the -repair option. Sformat will first try to read the old content of the defective block and then try to refresh the data by writing the old data to the block. If it fails to write to the block, sformat will reassign the defective block. If the block does not cause errors after rewriting the data in it, sformat will ask if the block should be reassigned anyway. NOTE: there are many cases in which a block seems to be defective but actually is not. If for any reason, the disk will be powered off during writing or if there is electro magnetic noise the CRC for a block may get corrupted without any physical harm to the magnetic media. These cases can be repaired by writing again to the block.

-refresh_only

Sformat will not try to reassign a block that still fails after rewriting (refreshing) the data in it. This option is useful in conjunction with the -reassign and the -repair option.

-repair

This is a combination of the -verify and -reassign option. Sformat will first verify the disk and then use the list of bad sectors found to repair the disk.

RW=#

Number of random R/W loops that is used with the -randrw option. The default is the number of physical sectors / 100. This will not last too long and is enough to cover every cylinder of the disk.

-scsi_compliant

Be as SCSI-compliant as possible. This will some old disk cause to fail in reporting mode pages correctly and may be used to see if a disk has these problems.

-seek

Do random or full stroke seek tests on the disk. This is done by reading data; trying to do full stroke seek tests my be impossible because of the cache of the disk.

-setmodes

Do a SCSI modeselect with all parameters, that would have been necessary for a format, but do not format the disk. This allows one to modify the mode pages of a disk without reformatting it. If the -smp option is used in conjunction with -setmodes the mode parameters will not be saved. In this case, the mode parameters of the disk will return to their old values if a reset or a power cycle occurs.

-silent, -s

Do not print out the status of failed commands.

-smp

Do not try to save mode parameters when setting them. This option is useful if a nearly totally damaged disk must be reformatted. Some disk controllers, in this case will reject to format the disk if the area on disk where this data will be stored is not accessible before formatting the disk.

-start

Send a SCSI START UNIT command to the device. This will normally spin up the spindle motor of a disk.

-stop

Send a SCSI STOP UNIT command to the device. This will normally spin down the spindle motor of a disk.

timeout=#

This option will set the default kernel timeout for all SCSI commands that are send by sformat to # seconds. The default value is 20 seconds. This option does not affect the timeout for the format command.

-tr, -t

This is an option that is only useful with old Adaptec SCSI bridge controllers. These controllers are not able to deal with logical sector numbers in some cases. Therefore these numbers have to be translated to the cylinder/head/bfi form before. This is done by seeking to the named block and reading the sector header. It may fail if the block has a bad sector header.

VL=#

Set the number of verify passes that are done after formatting a disk to #. The default value is 5. In write verify mode, this number is doubled because sformat will alternate write verify and read verify passes in this case.

-verbose, -v

outdated verbose option for SCSI commands.

-V

Increment the verbose level in respect of SCSI command transport by one. This helps to debug problems with SCSI commands. If you get incomprehensible error messages you should use this flag to get more detailed output. -VV will show data buffer content in addition. Using -V or -VV slows down the process and may be the reason for a buffer underrun.

-verify

This options starts sformat in verify disk (surface analysis) mode. Verifying a disk is a method that allows one to scan for defects without modifying data on the disk. In this mode, the controller will read the disks without transferring data to the computer while all error recovery is disabled.

Vstart=#

Set the first block for the -verify, -repair, -randrw or the -seek option to #. This is recommended when doing a surface analysis on large disks where is is known that the bad sector is near the end of the disk.

Vend=#

Set the last block for the -verify, -repair, -randrw or the -seek option to #. This is recommended when doing a surface analysis on large disks where is is known that the bad sectors are not at the end of the disk.

-wrveri

If this option is used in while formatting a disk, it tells sformat to write verify the disk instead of only read verifying it after formatting. If it is used in combination with the -verify option, sformat will write verify the disk without prior formatting. In both cases, the old data on disk will be damaged. Write verifying a disk is recommended if the disk is older than two years or has unusual defects. Usual defects in this context are recovered read errors and defects that disappear when simply writing to the defect sector.

## How To Answer Questions
There are four types of questions.

•

Questions that can be answered with yes or no. Yes may be abbreviated with 'y' or 'Y'. These questions are always assumed to be answered with no if you simply enter carriage return. NOTE: the latter is always a safe answer. All questions that request confirmation for actions that may damage or modify data on disk are formed in such a way that answering them with no or carriage return will not harm any data. All answers to this type of questions except [y]es or [Y]ES are interpreted as if no has been entered.

•

Questions that need a string as input. If you simply enter carriage return to this type of question, no modification of the default string will be done.

•

Questions that need a word selected from a list of valid words as input. If you enter '?', you will get a list of possible input to that question. Each word is on a separate line an (in some cases) is followed by a explanation how to use it.

•

Questions that need a number within a certain range. For this type of questions, sformat displays the current value and the valid range in parenthesis. The default radix for numbers is ten. If you need to enter a hexadecimal number precede it with 0x if you need to enter an octal number, precede it with 0.

^

Entering an accent circumflex '^' will set the value to the smallest possible

$

Entering an dollar sign '$' will set the value to the greatest possible

+

Entering a plus sign will increment the current value by one.

-

Entering a minus sign will decrement the current value by one.

<CR>

Entering a carriage return will not modify the current value. If the default value is -1, you need to supply a valid value to be allowed to leave the question menu.

All questions that do not request a simple string (second type of question) will accept a question mark '?' to display online help.

## The SCSI Selection Menu
When Sformat is started without or with insufficient parameters, the SCSI menu mode is entered. A typical output in this case looks like:

```
sparky joerg > sformat
sformat SCSI format/analysis/repair utilities
Release 3.1, Copyright J. Schilling
scg0 at esp0 initiator id 7
scg1 at esp1 initiator id 7
scsibus0:
c0t0d0           0) 'Quantum ' 'XP34300         ' 'F76D' Disk
c0t1d0           1) 'SEAGATE ' 'ST11200N        ' '8334' Disk

                 2) *
c0t3d0           3) 'TOSHIBA ' 'MK537FB/        ' '6258' Disk

                 4) 'WANGTEK ' '5150ES SCSI-36  ' 'ESB6' Removable Tape

                 5) 'EXABYTE ' 'EXB-8500-85QUE  ' '0428' Removable Tape

                 6) 'TOSHIBA ' 'XM-3401TASUNSLCD' '3593' Removable CD-ROM

                 7) HOST ADAPTOR
scsibus1:
c1t0d0,c1t0d1   10) 'EMULEX  ' 'MD21/S2     ESDI' 'D00 ' Disk

                11) *
c1t2d0          12) 'Maxoptix' 'T3-1304         ' '1.1c' Removable Disk

                13) *

                14) *

                15) *

                16) *

                17) HOST ADAPTOR
Select target -1 (0 - 12)/<cr>:
```

The line:

```
c0t0d0           0) 'Quantum ' 'XP34300         ' 'F76D' Disk
```

shows the canonical logical disk name (in this case c0t0d0), the menu number, the SCSI inquiry string and a description of the device type that was found on this SCSI target. The menu number is directly related to the SCSI target id of the device and the SCSI bus number. Number 3 is SCSI target # 3 on SCSI bus # 0. Number 12 is SCSI target # 2 on SCSI bus # 1. Sformat is currently not able to deal with more than 8 targets on a bus.

When selecting a target (.e.g. # 0), a logical unit selection menu will be displayed.

```
Select target -1 (0 - 6)/<cr>:0
scsibus0 target 0:
c0t0d0           0) 'Quantum ' 'XP34300         ' 'F76D' Disk

                 1) 'Quantum ' 'XP34300         ' 'F76D' unsupported

                 2) 'Quantum ' 'XP34300         ' 'F76D' unsupported

                 3) 'Quantum ' 'XP34300         ' 'F76D' unsupported

                 4) 'Quantum ' 'XP34300         ' 'F76D' unsupported

                 5) 'Quantum ' 'XP34300         ' 'F76D' unsupported

                 6) 'Quantum ' 'XP34300         ' 'F76D' unsupported

                 7) 'Quantum ' 'XP34300         ' 'F76D' unsupported
Select lun -1 (0 - 7)/<cr>:
```

The logical unit menu has the same structure as the SCSI target menu. If the device description contains the word unsupported, the controller is not able to support a logical unit of this number. If the device description contains the word unit not present, the controller is able to support a logical unit of this number but there is actually no device connected.

When selecting a specific logical unit, the main thread is entered as if a complete SCSI target specification has been entered from the command line.

## Following The Main Thread
If the main formatting thread is entered, the following stages are encountered:

Mapping and checking

The first thing sformat does, is to map the SCSI target/lun/busid triplet into a logical disk name and to check if some part of the disk is currently mounted. This mapping will be skipped if the -nomap options is specified. If the disk is mounted, the user will be asked if it is OK to continue.

Note: this is currently the one and only question.

Inquiry

The second action is getting the inquiry data from the device. The device type is determined from this data.

Test if device is ready

The next action is to test whether the device is ready and to wait for the device to become ready. When the device is ready, it is recalibrated.

Exit for wrong device type

When the device is not a disk, a worm media or optical memory, sformat terminates.

Read sinfo data

When the device is a disk, sformat tries to read the sinfo data from the disk. This allows the user to see if the device has been formatted with sformat before. If so, sformat will print out the number of reformats and the date of the first and last format. Sinfo is .B sformat specific data that is hold on the last block of the disk.

Process special commands

If options tell sformat to take special actions (like -start or -prdefect), they are done here. Sformat terminates after processing them.

The formatting procedure starts

The next actions are in preparation for formatting the disk. Several other things can be done from this thread. Modifying the disk label will be one example. You need not to be in fear that following this thread will modify or harm data on the disk. There will be extra questions that secure this case.

Test whether the disk is formatted

Several procedures differ if the disk is already formatted and has a valid label.

The next parts of the main thread will give you some questions to answer. You may skip most of the questions if you do not want to modify anything.

If some data that is definitely needed by sformat can not be determined from the disk or the data base, sformat will force you to answer all questions of a group. Sformat will only ask question for parameters that are definitely needed or may be changed on the current disk. The content of the menus differ from disk to disk.

Read mode data

Several mode pages of the disk are read. This data and the inquiry data is used to search in the disk data base.

Sformat asks:

Ignore database disk parameters from 'sformat.dat'?

If you don't want the data from the data base to be used, negotiate the appropriate question. Some disks cannot be determined from the fetchable data. This are mainly disks that are connected to a bridge controller e.g. a controller from ESDI to SCSI. Sformat is able to detect the right data in the data base for disks with changeable media e.g. optical disks that support different media with different capacity and geometry. If there is more than one possible entry for this disk in the data base,

sformat asks:

Select alternate disk type?

If the disk type menu is entered, all possible data base entries are displayed. The current entry is marked with '*', the default entry is marked with '+' and the entry most similar to the current disk is marked with '~'. A matching factor is displayed in parenthesis. Higher values are indicating a better match.

Read in label data

If the disk is already formatted, sformat reads in the label and ask whether to remember this data.

Sformat asks:

Ignore old disk Label?

I you confirm this question and reformat the disk, the old partitioning information will be lost.

Disk Parameters Menu

If you want to modify some disk parameters answer the next question with 'y'.

Sformat asks:

Modify Disk Geometry Parameters?

This enables to modify basic data on geometry, the interleaving factor and the defect management system. If you want to do spindle synchronization, activate it here.

Error Recovery

Error recovery parameters include read/write retry count and similar.

Sformat asks:

Modify Error recovery Parameters?

Disconnect Parameter

Disconnect parameters are buffer full/empty ratio and bus inactivity limit.

Sformat asks:

Modify Disconnect Parameters

Alternate Label

If you want to use an alternate label that may be in the data base go into the next menu.

Sformat asks:

Select alternate Label?

The current entry is marked with '*', the default entry is marked with '+'.

Logical Label Geometry

Sformat uses an abstract geometry in the label. This allows one to have one label for a group of disks. The label geometry menu allows one to modify this abstract geometry.

Sformat asks:

Modify Label Geometry Parameters?

SCSI Parameters

This menu contains questions about command queuing, defect list format and similar. Some disks do not support the default block defect list format. Specify another format in this case here. If the disk does not support the SCSI write-verify command, sformat allows one to split this into a SCSI write and a SCSI verify command. The data cannot be compared in this case. If the disk type is generally flaky a data base entry can be set up to do write verify as default after formatting. If the disk will not handle 1000 blocks per verify command because of a firmware bug, a smaller value may be specified here.

Sformat asks:

Modify SCSI Parameters?

Grown Defect List

If a disk has not been formatted before or has been refurbished, you should clear the old grown defect list to get a clean start. If the disk has bad blocks, sformat will find them after formatting while doing the surface analysis. If the disk has known defects you should negotiate the next question to keep the defect list.

Sformat asks:

Clear old grown defect list?

Mode pages

If you want to format the disk, you need to set the mode pages before.

Sformat asks:

Set mode pages (needed for format)?

However, if you do not want to format the disk, you may negotiate this question and will be lead to the label modification menu.

Formatting the disk

The next question is the last one you will be asked before starting to format the disk. If formatting has started, you will see the progress of this process indicated in the used up percentage of the estimated time.

Sformat asks:

Format Disk destroys all Data. Really?

If you only want to set the mode pages, you may this question with 'n'.

Creating and modifying the disk label

After the disk has been formatted or if the formatting has been denied, the label menu is entered.

Sformat asks:

Print disk label?

If you want to see the current layout of the disk label, enter 'y'.

Sformat asks:

Modify disk label?

If you want to modify the disk label enter 'y'.

Inside the label modification menu

Sformat asks:

Label: <Quantum XP34300> change ?

If you want to retain the old label name, enter <CR>, else enter 'y'. Sformat will ask for the new Label name.

Sformat asks:

Enter disk label: Quantum XP34300

You are left in the tty line edit mode and may modify the input line (see termio(4) manual page).

Sformat asks:

Volume Name: <> change ?

If you want to retain the old label name, enter <CR>, else enter 'y'. Sformat will ask for the new Volume name.

Sformat asks:

Change partition table?

If you want to change the partition table enter 'y'.

Sformat asks:

```
Part     Tag Flag  Cylinders Startsec # of Sec      Size    Blocks

0       root wm     0 -   30        0    67580     32.99MB (31/0/0)

Change ?

```

If you want to modify this partition enter 'y', otherwise enter <CR> until sformat asks for the partition you want to change.

Sformat asks:

Enter partition id Tag [root]:

Enter <CR> if the partition tag is ok for this partition, otherwise enter '?' to get a list of valid partition tags or enter the new partition tag.

Sformat asks:

Enter partition permission Flags [wm]:

Enter <CR> if the partition flag is ok for this partition, otherwise enter '?' to get a list of valid partition flags or enter the new partition flag.

Sformat asks:

Enter starting cylinder 0 (0 - 3851)/<cr>:

Enter <CR> if the starting cylinder is ok for this partition, otherwise enter '?' to get a list of possible input. XXX

Sformat asks:

Enter number of blocks 67580, 31/0/0 (0 - 8395180)/<cr>:

Enter <CR> if the size is ok for this partition, otherwise enter '?' to get a list of possible input. XXX

Sformat asks:

```
Part     Tag Flag  Cylinders Startsec # of Sec      Size    Blocks

0       root wm     0 -   30        0    67580     32.99MB (31/0/0)

Ok ?

```

Enter <CR> if you still want to modify the partition record. You then will be asked again for all parameters of this partition. Enter 'y' if this partition is now ok. If all partitions are cycled through, sformat will display the current label.

Sformat asks:

Use this label?

If you enter 'y', sformat will update the label on disk and go into the verify mode. Anything else will put you into the label modification mode again.

Disk Verification

In disk verification mode, sformat will do a surface analysis. If a bad block is encountered, sformat will reassign this bad block. XXX

## How To Format A Disk
The number of defects that SCSI disks can handle depends on the defect mapping system they use. There are several possible systems:

The mapping system depends on the # of tracks per zone in the SCSI disk parameters. Mapping area in this table means spare location.

1)

One mapping area at the end of the disk. (tpz == 0)

2)

One mapping area per track. (tpz == 1)

3)

One mapping area per cylinder. (tpz == nhead)

4)

Some mapping areas on on the disk (tpz > nhead)

If all the space in the defect spare locations above is used up, there still may be an additional mapping area at the end of the disk. This is controlled by the alternate tracks per volume parameter.

If your disk says no defect spare location, you may be able to get extra space by going into the disk parameter menu of sformat and change a value. Note: some disks tell you that some of the values are changeable (there is a range in parenthesis) but actually ignore the new value. You will have to read the values after formatting to see if the new parameters are in effect.

## How To Modify A Label
Remember, don't panic. You need no desk calculator to create or modify a partition table.

The alternate cylinders are historic relics. In good old days (1982) when SMD disks that were not able to do defect mapping have been used, these alternates were added to do the defect mapping in the driver. In these days the space occupied by these spare cylinders really has been used as alternate (spare) space.

Currently they are only used for some copies of the primary disk label and an outdated copy of the defect list is only able to hold 127 defects :-(.

The label geometry cannot be changed in the partition menu. It must be set before from the Label Parameters menu.

Print disk label?

If this question is answered with 'y', the label and partitioning info will be displayed.

Modify disk label?

If this question is answered with 'y', the label modification menu will be entered.

Label: <Toshiba 1015MB> change ?

If this question is answered with 'y', the name of the label nay be modified.

Volume Name: <5.3> change ?

If this question is answered with 'y', the system V volume name may be altered.

Change partition table?

If this question is answered with 'y', a partition menu will be displayed.

Use this label?

## Graphical Label Display
When printing the label or partition data, sformat uses a simple ASCII graphical display to visualize the layout of the partitions. The symbols used in this graphic display are described below.

Example:

```
a I--/
b    /-----------/
c I----------------------------------------------------------------------I
d partition not defined
e             <--/
f                /--------/
g                                        <-------------------------------I
h                         /----------------------------------------------I
WARNING:
part 'e' has unaligned start.
part 'g' has unaligned start.
```

Used symbols:

I

Used to mark the start end the end of the disk (no error).

X

Partition starts before zero or exceeds end of disk.

/

Partition has an adjacent start or end with another partition (no error).

+

Two or mode partitions have the start or the end at the same position on the disk but no other partition connects to this point. This is an error that indicates that there may be unused space on the disk.

<

This partition does not connect to another partition on its beginning. This is an error that indicates that there may be unused space on the disk.

>

This partition does not connect to another partition on its end. This is an error that indicates that there may be unused space on the disk.

*

Internal error in the check routines (should never happen).

Errors:

ends behind lncyl

Partition is bigger than possible.

One or more parts are not within range of part 'c'!

Partition 'c' (2) should be the whole disk. This warning indicates a disk that deviates from this rule.

Warnings:

unaligned start

The partition starts not in conjunction to another partition.

unaligned end

The partition ends not in conjunction to another partition.

space before start

There is no partition that uses the space between the beginning of the disk and the beginning of this partition.

space after end

There is no partition that uses the space between the end of this partition and the end of the disk.

## FILES
/opt/schily/etc/sformat.dat

A database with mode pages and disk partitions for disks.

## BUGS
This draft man pages sucks.

Mail bugs and suggestions to schilytools@mlists.in-berlin.de or open a ticket at https://codeberg.org/schilytools/schilytools/issues.

The mailing list archive may be found at:

https://mlists.in-berlin.de/mailman/listinfo/schilytools-mlists.in-berlin.de.

## AUTHOR
sformat has been written in 1986 for SunOS by Joerg Schilling. It was the first disk formatting program that worked under control of the OS. It was needed to speed up production at H. Berthold AG and to make the Siemens MegaFile disk usable that needed a special track skew value that was not supported by the standalone bootable Sun disk formating program.

After cdrecord has been made portable, sformat could be made portable as well.

sformat is now maintained by the schilytools project authors.

## SOURCE DOWNLOAD
The source code for sformat is included in the schilytools project and may be retrieved from the schilytools project at Codeberg at

https://codeberg.org/schilytools/schilytools.

The download directory is

https://codeberg.org/schilytools/schilytools/releases.


scponly

package: scponly

title: scponly(8)

text:
# scponly(8)

## NAME
scponly

## SYNOPSIS
scponly

— limited shell for secure file transfers

## DESCRIPTION
scponly is an alternative "shell" (of sorts) for system administrators who would like to provide access to remote users to both read and write local files without providing any remote execution privileges. Functionally, it is best described as a wrapper to the trusted suite of ssh applications.

A typical usage of scponly is in creating a semi-public account not unlike the concept of anonymous login for ftp. This allows an administrator to share files in the same way an anonymous ftp setup would, only employing all the protection that ssh provides. This is especially significant if you consider that ftp authentications traverse public networks in a plaintext format.

Instead of just a single anonymous user, scponly supports configuring potentially many users, each of which could be set up to provide access to distinct directory trees. Aside from the installation details, each of these users would have their default shell in /etc/passwd set to "/usr/local/bin/scponly" (or wherever you choose to install it). This would mean users with this shell can neither login interactively or execute commands remotely. They can however, scp files in and out, governed by the usual Unixish file permissions.

## FEATURES

- Logging: scponly logs time, client IP address, username, and the actual request to syslog.

- chroot: scponly can chroot to the user's home directory (or any other directory the user has permissions for), disallowing access to the rest of the filesystem.

- sftp compatibility: My testing of sftp against an scponly user worked great. This is probably the cleanest and most usable way for an scponly user to access files.

- Security checks: root login is disallowed (though root should never be configured to be using scponly as the default shell.)

- WinSCP 2.0 compatibility: scponly can be compiled in WinSCP compatibility mode that will permit a "semi-interactive" shell that WinSCP can use.

- gftp compatibility: scponly is compatible with gftp if you set "use ssh2 sftp subsys" in your gftp options.

scponly doesn't do anything to manage read/write permissions. The ssh applications already do that just fine. If you use scponly, be aware that good old Unix-style file permissions are still doing the work of protecting your files.

## NOTES

- As recent as June 26, 2002, vulnerabilities have been discovered in OpenSSH. There is also a SSH1 protocol vulnerability. If you're going to use scponly , be aware it is no more secure than the ssh installation it runs on.

- I've since discovered that ssh.com's commercial ssh offering supports BOTH "dummy users" as well as functionality paralleling scponly. I have not been able to find any notes on these features, but I did read that they exist. I will make a point to include more information later. It appears that OpenSSH does not yet support these features. At this time, I have no plans to end-of-life scponly, though ultimately, I recognize that scponly should eventually become just a feature of whichever sshd you may run.

## FILES
/usr/local/bin/scponly

The default location for the shell itself.

/usr/local/sbin/scponlyc

The default location for the chrooted version of scponly

/etc/shells

To be a proper shell, it has to be included here.

## SEE ALSO
chroot(2), ssh(1), scp(1), sftp(1), shells(5), sshd(8).

## AUTHORS
Joe Boyle ⟨joe@sublimation.org⟩.

## LEGALITIES
Copyright (C) 2001, 2002, 2003

Joe Boyle ⟨joe@sublimation.org⟩.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## BUGS
Versions prior to 2.4 have a vulnerability wherein the .ssh/environment file can be used to override $PATH and $LD_LIBRARY_PATH vars, compromising the shell.


scsiadd

package: scsiadd

title: scsiadd(8)

summary: Add and remove SCSI devices

text:
# scsiadd(8)

## NAME
scsiadd - Add and remove SCSI devices

## SYNOPSIS
scsiadd {-a|-r} <id>

scsiadd {-a|-r} <id> <lun>

scsiadd {-a|-r} <host> <id> <lun>

scsiadd {-a|-r} <host> <channel> <id> <lun>

scsiadd [-i maxid] -s <host>

scsiadd [-i maxid] -s <host> <channel>

scsiadd -p

## DESCRIPTION
scsiadd adds and removes devices, scans for new devices, or prints the status of the SCSI bus. The options are:

-a

add device

-r

remove device

-s

scan for new devices

-p

print SCSI status

-i

set maximum SCSI ID which is scanned

## FILES
scsiadd need the /proc/scsi/scsi file to send its commands to the linux kernel. In 2.6 kernels this file is considered deprecated and you have to enable the following kernel option so this file is generated:

Device Drivers->SCSI device support->legacy /proc/scsi/ support

## EXAMPLES
scsiadd 3

add SCSI device with ID 3 on primary host

scsiadd -r 1

remove SCSI device with ID 1 from primary host

scsiadd -s

scan for new devices on primary device

scsiadd -a 1 2 13 4

add SCSI device with ID 13 and LUN 4 on host 1 channel 2

## AUTHOR
Dirk Jagdmann <doj@cubic.org>

The latest version can be found at http://llg.cubic.org/tools

## SEE ALSO
http://www.tldp.org/HOWTO/SCSI-2.4-HOWTO/index.html

Howto describing many aspects of the Linux 2.4.0 SCSI system


tgt-admin

package: scsitarget-utils

title: tgt-admin(8)

summary: Linux SCSI Target Configuration Tool

text:
# tgt-admin(8)

## NAME
tgt-admin - Linux SCSI Target Configuration Tool

## SYNOPSIS
tgt-admin [-e --execute] [--delete <value>] [--offline <value>] [--ready <value>] [-s --show] [-C --control-port <NNNN>] [-c --conf <file>] [--ignore-errors] [-f --force] [-p --pretend] [--dump] [-v --verbose] [-h --help]

## DESCRIPTION
tgt-admin is a utility which allows a persistent configuration of targets and luns. It uses tgtadm commands to create, delete and show targets.

## OPTIONS
-e, --execute

Read /etc/tgt/targets.conf and execute tgtadm commands. If the target already exists, it won't be processed. See --update.

-d, --delete <value>

Delete all or selected targets. The target will be deleted only if it's not used (no initiator is connected to it). If you want to delete targets which are in use, you have to add the "--force" flag.

```
Example usage:

    --delete ALL            - delete all targets

    --delete tid=4          - delete target 4

                              (target with tid 4)

    --delete iqn.2008-08.com.example:some.target

                            - delete this target

```

--offline

Put all or selected targets in offline state.

```
Example usage:

    --offline ALL           - offline all targets

    --offline tid=4         - offline target 4

                              (target with tid 4)

    --offline iqn.2008-08.com.example:some.target

                            - offline this target

```

--ready

Put all or selected targets in ready state.

```
Example usage:

    --ready ALL             - ready all targets

    --ready tid=4           - ready target 4

                              (target with tid 4)

    --ready iqn.2008-08.com.example:some.target

                            - ready this target

```

--update <value>

Update all or selected targets. The target will be updated only if it's not used (no initiator is connected to it). If you want to update targets which are in use, you have to add "--force" flag.

```
Example usage:

    --update ALL             - ready all targets

    --update tid=4           - ready target 4

                               (target with tid 4)

    --update iqn.2008-08.com.example:some.target

                             - update this target

```

-s, --show

Show all the targets.

-C, --control-port <NNNN>

It is possible to run multiple concurrent instances of tgtd on a host. This argument is used to control which instance the tgt-admin command will operate on.

-c, --conf <configuration file>

Specify an alternative configuration file instead of /etc/tgt/targets.conf, which is the default.

--ignore-errors

Continue even if tgtadm exits with non-zero code.

-f, --force

Force some operations even if the target is in use.

-p, --pretend

Only print tgtadm options which would be used; don't execute any actions. Assumes -v.

--dump

Dump current tgtd configuration. Note: does not include detailed parameters, like write caching.

-v, --verbose

Increase verbosity (show tgtadm commands used).

-h, --help

Display a list of available options and exit.

## FILES
/etc/tgt/targets.conf

Configuration file for tgt-admin.

/usr/share/doc/tgt/targets.conf.example

Example configuration file for tgt-admin.

## SEE ALSO
targets.conf(5), tgtd(8), tgtadm(8), tgtimg(8), tgt-setup-lun(8). https://github.com/fujita/tgt

## REPORTING BUGS
Report bugs to <stgt@vger.kernel.org>


tgt-setup-lun

title: tgt-setup-lun(8)

text:
# tgt-setup-lun(8)

## NAME
tgt-setup-lun - Helper script that creates a target, adds a device to the target, and defines initiators that can connect to the target

## SYNOPSIS
tgt-setup-lun -d <device> -n <targetname> [-b <bsname>] [-t <transport>] [-C <control_port>] [initiator_IP...] [-h]

## DESCRIPTION
Creates a target according to the supplied target_name. tgtd must be running. The format of the default IQN generated from the target name is: "iqn.2001-04.com.<hostname>-<target_name>", or a complete IQN may be given. The target name must be unique.

The script then adds the requested device to the target. If specific IP addresses are defined, it adds them to the list of allowed initiators for that target. If no IP addresses is defined, it defines that the target accepts any initiator.

## EXAMPLES
Create a target that uses /dev/sdb1 and allows connections only from 192.168.10.81:

```
      tgt-setup-lun -d /dev/sdb1 -n my_target 192.168.10.81

```

Create a target that uses /dev/sdb1 and allows connections only from 192.168.10.81 and 192.168.10.82:

```
      tgt-setup-lun -d /dev/sdb1 -n my_target 192.168.10.81 192.168.10.82

```

Create a target that uses /dev/sdb1 and allows connections from any initiator:

```
      tgt-setup-lun -d /dev/sdb1 -n my_target

```

Display help:

```
      tgt-setup-lun -h

```

## AUTHOR
Written by Erez Zilber

## SEE ALSO
targets.conf(5), tgtd(8), tgtadm(8), tgtimg(8), tgt-admin(8). https://github.com/fujita/tgt

## REPORTING BUGS
Report bugs to <stgt@vger.kernel.org>

## COPYRIGHT
Copyright ï¿½ Voltaire Ltd. 2008.


tgtadm

title: tgtadm(8)

text:
# tgtadm(8)

## NAME
tgtadm - Linux SCSI Target Administration Utility

## SYNOPSIS
tgtadm [OPTIONS]... [-C --control-port <port>] [-L --lld <driver>] [-o --op <operation>] [-m --mode <mode>] [-t --tid <id>] [-T --targetname <targetname>] [-y --blocksize <size>] [-Y --device-type <type>] [-l --lun <lun>] [-b --backing-store <path>] [-f --bsoflags {direct|sync}] [-S --bsopts {backing-store opt string}] [-E --bstype <type>] [-I --initiator-address <address>] [-Q --initiator-name <name>] [-n --name <parameter>] [-v --value <value>] [-P --params <param=value[,param=value...]>] [-F --force] [-h --help]

## DESCRIPTION
tgtadm is used to monitor and modify everything about Linux SCSI target software: targets, volumes, etc.

## OPTIONS
-C, --control-port <port>

It is possible to run multiple concurrent instances of tgtd on a host. This argument is used to control which instance the tgtadm command will operate on.

-y, --blocksize <size>

Block devices are created with a default block size of 512 bytes. This argument can be used to create block devices with different block sizes.

```
Example:
tgtadm --lld iscsi --mode logicalunit --op new \

       --tid <TID> --lun <LUN> \

       -b <backing-file> --blocksize=4096

```

-Y, --device-type <type>

When creating a LUN, this parameter specifies the type of device to create. Default is disk.

```
Possible device-types are:

    disk    : emulate a disk device

    tape    : emulate a tape reader

    ssc     : same as tape

    cd      : emulate a DVD drive

    changer : emulate a media changer device

    pt      : passthrough type to export a /dev/sg device

```

-E, --bstype <type>

When creating a LUN, this parameter specifies the type of backend storage to to use.

```
Possible backend types are:

    rdwr    : Use normal file I/O. This is the default for disk devices

    aio     : Use Asynchronous I/O

    rbd     : Use Ceph's distributed-storage RADOS Block Device

    sg      : Special backend type for passthrough devices

    ssc     : Special backend type for tape emulation

```

--lld <driver> --op new --mode target --tid <id> --targetname <name>

Add a new target with <id> and <name>.

--lld <driver> --op delete --mode target --tid <id>

Delete specific target with <id>. The target must have no active I_T nexus.

--lld <driver> --op delete --force --mode target --tid <id>

Delete specific target forcibly with <id>.

--lld <driver> --op show --mode target

Show all the targets.

--lld <driver> --op show --mode target --tid <id>

Show target parameters of a target with <id>.

--lld <driver> --op new --mode logicalunit --tid <id> --lun <lun> --backing-store <path> --bsopts=<backing store options>

Add a new logical unit with <lun> to specific target with <id>. The logical unit is offered to the initiators. <path> must be block device files (including LVM and RAID devices) or regular files, or an RBD image or snapshot name for --bstype rbd. lun0 is reserved for a special device automatically created.

```
Example:
If tgt is compiled with the bs_rbd backing store for
Ceph RBD images (see tgtadm --mode system --op show to
verify), set up a target mapping the rbd image named
"rbdimage", and pass options to bs_rbd:
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 \
--lun 1 --bstype=rbd --backing-store=rbdimage \
--bsopts="conf=/etc/ceph/ceph.conf;id=tgt"

```

--lld <driver> --op delete --mode logicalunit --tid <id> --lun <lun>

Delete specific logical unit with <lun> that the target with <id> has.

--lld <driver> --op bind --mode target --tid <id> --initiator-address <address>

Add the address to the access lists of the target with <id>. Initiators with the address can access to the target. 'ALL' is a special address to allow all initiators to access to a target.

--lld <driver> --op bind --mode target --tid <id> --initiator-name <name>

Add the initiator's name to the access lists of the target with <id>. Initiators with the names can access to the target.

--lld <driver> --op unbind --mode target --tid <id> --initiator-address <address>

Delete the address from the access lists of the target with <id>.

--lld <driver> --op unbind --mode target --tid <id> --initiator-name <name>

Delete the initiator's name from the access lists of the target with <id>.

--lld <driver> --op update --mode target --tid <id> --name=<parameter> --value=<value>

Change the value of <parameter> of the target with <id> to <value>.

--lld <driver> --op update --mode target --tid <id> --params parameter=value<,...>

Sets/changes the value of one or more target parameters.

--lld <driver> --op update --mode logicalunit --tid <id> --lun <id> --params parameter=value<,...>

Sets/changes the value of one or more logical unit parameters.

--lld <driver> --op start --mode lld

Start the specified lld without restarting the tgtd process. Can be used to initialize lld driver in case required modules were loaded after tgtd was already executed.

--help

Display a list of available options and exits.

## LUN PARAMETERS
These parameters are only applicable for "--mode logicalunit".

vendor_id=<string>

This parameter sets the Vendor Identification string that a LUN will report in INQURY data.

product_id=<string>

This parameter sets the Product Identification string that a LUN will report in INQURY data.

product_rev=<string>

This parameter sets the Product Revision string that a LUN will report in INQURY data.

```
Example:
tgtadm --lld iscsi --mode logicalunit --op update \

       --tid <TID> --lun <LUN> \

       --params vendor_id=TGTD,product_id=VirtualHD,product_rev=0103

```

removable=<0|1>

This can be used to override/change the default setting for the removable flag. Disk devices default to non-removable while DVD and TAPE devices default to removable.

sense_format=<0|1>

This flag controls the format of sense data that the device will return. 0 = Clasic sense format, 1 = Support descriptor format.

online=<0|1>

This controls whether a device is online or not. Devices default to be online when created but can be brought offline using this parameter. Behaviour of offline devices depend on device type. An MMC/DVD device that is offline will report that there is no disk in the unit but the actual MMC/DVD unit itself can still be communicated with. All other device types will fail all I/O with a sense code of Not Ready.

```
Example:
tgtadm --lld iscsi --mode logicalunit --op update \

       --tid 1 --lun 1 \

       --params removable=1,sense_format=1,online=1

```

mode_page=<byte-string>

This parameter is used to set specific mode pages for the device and the mode page contents. Most devices default to reasonable default mode pages automatically when the LUN is created, but this allows special settings.

```
Examples:
Create mode page '2', subpage 0 and 14 bytes of data.
This is Disconnect-Reconnect mode page.
tgtadm --mode logicalunit --op update --tid 1 --lun 2 \

         --params mode_page=2:0:14:0x80:0x80:0:0xa:0:0:0:0:0:0:0:0:0:0
Create mode page '10', subpage 0 and 10 bytes of data.
This is Control Extension mode page.
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 \

         --params mode_page=10:0:10:2:0:0:0:0:0:0:0:2:0
Create mode page '0x1c', subpage 0 and 10 bytes of data.
This is Informational Exceptions Control mode page.
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 \

         --params mode_page=0x1c:0:10:8:0:0:0:0:0:0:0:0:0

```

readonly=<0|1>

This sets the read-only flag of a LUN. A read-only LUN will refuse any attempts to write data to it. This parameter only applies to DISK devices.

```
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 \

         --params readonly=1

```

thin_provisioning=<0|1>

This controls the provisioning for the LUN. A thin-provisioned LUN is represented as a sparse file. TGTD supports provisioning type 2 for sparse files. When initiators use the SCSI UNMAP command TGTD will release the affected areas back to the filesystem using FALLOC_FL_PUNCH_HOLE. This parameter only applies to DISK devices.

Thin-provisioning works for LUNs stored on filesystems that support FALLOC_FL_PUNCH_HOLE.

When using thin-provisioning option with a block device such a SSD or ZVOL, UNMAP SCSI command discards the region from the block device.

```
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 \

         --params thin_provisioning=1

```

rotation_rate=<uint32>

This sets the reported rotation rate in RPM of the LUN to the initiator. Some operating systems assume a SSD type disk when this parameter is zero. This parameter only applies to DISK devices.

```
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 \

         --params rotation_rate=0

```

## SMC SPECIFIC LUN PARAMETERS
These parameters are only applicable for luns that are of type "changer" i.e. the media changer device for a DVD Jukebox or a Virtual Tape Library.

element_type=<1|2|3|4>

This controls which type of element a certain slot in the jukebox/vtl is.

```
Slot types:

 1 -> Medium Transport (picker arm)

 2 -> Storage Element

 3 -> Import/Export Element

 4 -> Data Transfer device (CD drive, tape drive, MO drive etc)

```

address=<1-65535>

This is used to create/operate on a single slot. Address specifies the slot on which to perform the operation.

start_address=<1-65535>,quantity=<1--65535>

This is used to create/operate on an entire range of slots at once. Start_address specifies the first address to operate on and quantity specifies the number of consequtive slots.

sides=<1|2>

When creating storage elements, i.e. "element_type=2", this parameter specifies if the media has 1 or two sides to hold data.

clear_slot=<1>

This option is used to clear a storage element and remove any media that may be present. Once this command completes the storage element will show up as "Empty".

barcode=<string>

This is used to assign a barcode to an element. Barcodes are limited to 10 characters in tgtd.

volume_tag=<string>

This is used to assign a volume tag to SMC storage elements. If no volume tag is specified tgtd will use fall back to the barcode. The volume tag can be up to 32 characters.

media_home=<string>

This parameter specifies a directory where all virtual media for the dvd/tape device elements are stored. To assign a media image file to a storage element slot, you assign "barcode" to be the name of the image file in the "media_home" directory.

```
Example: How to create a DVD jukebox with eight disk trays and
two empty DVD-R disks.
# Create a target
tgtadm --lld iscsi --mode target --op new --tid 1 --targetname iqn.2007-03:virtual-dvd:`hostname`
# Create a DVD drive and give it a nice name
# The dvd starts out without a backing store file, i.e. no disk loaded
tgtadm --op new --mode logicalunit --tid 1 --lun 1 --device-type cd
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 --params vendor_id=STGT_DVD,product_id=DVD101,product_rev=0010,scsi_sn=STGTDVD01,removable=1
# We need a backend store file for the media changer
if [ ! -f $HOME/smc ]; then
	dd if=/dev/zero of=$HOME/smc bs=1k count=1
fi
# Create the SMC device and give it a nice name
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 --backing-store $HOME/smc --device-type changer
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params vendor_id=STK,product_id=L700,product_rev=0010,scsi_sn=XYZZY_0,removable=1
# Add a Data Transfer devices (1 drive)
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=4,start_address=1,quantity=1
# Specify that the DVD above (LUN 1) is the data transfer device we created
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=4,address=1,tid=1,lun=1
# Medium Transport Elements (robot arm / picker)
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=1,start_address=16,quantity=1
# define path to virtual media
VTL=${HOME}/vtl
mkdir -p ${VTL}
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params media_home=${VTL}
# Storage Elements - 8 starting at addr 1024
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=2,start_address=1024,quantity=8
# Add 'media' to slots 1 and 2 and leave the other 6 slots empty
# slot 1
# Create empty writeable virtual DVD-R media
tgtimg --op new --device-type cd --type dvd+r --file ${VTL}/DISK_001
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=2,address=1024,barcode=DISK_001,volume_tag="A blank disk",sides=1
# slot 2
tgtimg --op new --device-type cd --type dvd+r --file ${VTL}/DISK_002
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=2,address=1025,barcode=DISK_002,volume_tag="My second blank disk",sides=1
# Allow ALL initiators to connect to this target
tgtadm --lld iscsi --mode target --op bind --tid 1 --initiator-address ALL
# Show all our good work.
tgtadm --lld iscsi --mode target --op show

```

## PASSTHROUGH DEVICES
In addition to device emulation TGTD also supports utilizing existing SG devices on the host and exporting these through a special passthrough device type.

--bstype=sg

This specifies that an SG devices is used.

--device-type=pt

This specifies that passthrough device type is used.

--backing-store=</dev/sg4>

This specifies which device to export through TGTD.

--bsoflags={direct|sync}

This argument is used when creating a LUN to specify extra flags to use when opening the backing file. O_DIRECT is specified by "direct" and O_SYNC by "sync".

```
Example:
Make /dev/sg4 available to initiators connecting to TGTD.
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 --bstype=sg --device-type=pt --backing-store=/dev/sg4
Example:
Open the backing file with O_SYNC.
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 --bsoflags="sync" --backing-store=/data/100m_image.raw

```

## HEADER DIGEST AND DATA DIGEST
Header and data digests can be set on a per target parameter. TGTD supports two modes, None and CRC32C. When the digest is set to None, TDTD will negotiate that digests will not be used, and when CRC32C is set, TGTD will force the connection to use digest.

### Viewing the current settings
This command is used to view the current settings for header/data digest.

```
tgtadm --op show --mode target --tid 1

  ...

  HeaderDigest=None

  DataDigest=None

  ...

```

### Setting digest

```
Set header digest to CRC32C:
tgtadm --op update --mode target --tid 1 -n HeaderDigest -v CRC32C
Set data digest to None:
tgtadm --op update --mode target --tid 1 -n DataDigest -v None

```

## CHAP AUTHENTICATION
CHAP authentication is supported to require authentication before an initiator is allowed to log in and access devices.

CHAP main-phase authentication is set on the target level. To set up CHAP authentication we first need to create an account and its associated password, then we bind the account to one or more targets.

### Setting CHAP on a target
These two commands create a user account and binds it to target 1.

```
tgtadm --lld iscsi --op new --mode account --user ronnie --password password
tgtadm --lld iscsi --op bind --mode account --tid 1 --user ronnie

```

### List all accounts
This command is used to list all accounts that have been created.

```
tgtadm --lld iscsi --op show --mode account
Account list:

    ronnie

```

### Show if a target requires authentication
When listing the targets, each target that has authantication enabled will contain a listing of all accoutns bound to that target.

```
tgtadm --lld iscsi --op show --mode target
Target 1: iqn.ronnie.test
...
Account information:

    ronnie
...

```

## NOP-OUT PROBES
TGTD can send NOP-OUT probes to connected initiators to determine when an initiator is dead and then automatically clear and tear down the TCP connection. This can either be set as a global default from the tgtd command-line or it can be set for individual targets using the tgtadm command.

### Check the current NOP-OUT setting
The tgtadm command is used to view the current setting for if/when to send NOP-OUT probes to connected initiators.

If the target is configured to send NOP-OUT probes this will show up as two parameter lines in the target printout. If the target is not configured to send NOP-OUT these lines will not be printed at all.

```
tgtadm --lld iscsi --op show --mode target
Target 1: iqn.ronnie.test

    System information:

        Driver: iscsi

        State: ready

        Nop interval: 5

        Nop count: 5

    I_T nexus information:

```

### Setting NOP-OUT for a target
The tgtadm command is used to change the NOP-OUT settings.

```
tgtadm --op update --mode target --tid 1 -n nop_count -v 5
tgtadm --op update --mode target --tid 1 -n nop_interval -v 5

```

## ISCSI PORTALS
iSCSI portals can be viewed, added and removed at runtime.

### List portals
This command is used to list the current iSCSI portals defined on the target:

```
tgtadm --lld iscsi --op show --mode portal
Portal: 10.1.1.101:3260,1
Portal: 127.0.0.1:3260,1

```

### Add portal
This command is used to add a portal to the target :

```
tgtadm --lld iscsi --op new --mode portal --param portal=10.1.1.101:3260

```

### Remove portal
This command is used to remove a portal from the target :

```
tgtadm --lld iscsi --op delete --mode portal --param portal=10.1.1.101:3260

```

## ISCSI CONNECTIONS
iSCSI connections can be viewed and forced closed at runtime.

### List all active connections for a target
This command is used to list the all the active iSCSI connections to the target with connection id, initiator name and ip address for the initiator :

```
tgtadm --lld iscsi --op show --mode conn --tid 1
Session: 2

    Connection: 0

        Initiator: iqn.2008-11.org.linux-kvm:

        IP Address: 127.0.0.1

```

### Close an existing connection
This command is used to close an iSCSI connection. Note that forcibly closing iSCSI connections can lead to data-loss.

```
tgtadm --lld iscsi --op delete --mode conn --tid 1 --sid 2 --cid 0

```

## ONLINE/OFFLINE STATUS
Tgtd LUNs can be in online or offline status. LUNs that are Offline behave slightly different depending on the device type. Offline devices behave as if there is no media available and any operations that access media will fail with an check-condition error.

Devices can not be set to Offline mode while there are "PREVENT ALLOW MEDIUM REMOVAL" locks on the device. Similarly media in Online devices can not be software ejected while there are such locks on the device (the 'eject' command will fail).

### Show Online/Offline status
Finding the Online/Offline status of a LUN is done through the tgtd command. If "Prevent removal" is "Yes" this indicates that an application holds a "prevent media removal" lock on the device.

```
tgtadm --lld iscsi --mode target --op show
...

        LUN: 2

            Type: cd/dvd

            SCSI ID: IET     00010002

            SCSI SN: beaf12

            Size: 3432 MB, Block size: 1

            Online: Yes

            Removable media: Yes

            Prevent removal: Yes
...

```

### Changing a LUN to Offline
A LUN is changed to Offline status using the tgtadm command. When devices are set Offline these devices will behave as if there is no media loaded into the drive.

Change a LUN to become offline. (no disk in the drive)

```
tgtadm --tid 1 --lun 2 --op update --mode logicalunit -P Online=No

```

## ISNS PARAMETERS
iSNS configuration for a target is by using the tgtadm command.

iSNSServerIP

This specifies the IP address of the iSNS server. TGTD only supprots one iSNS server.

```
Example:
tgtadm --op update --mode sys --name iSNSServerIP --value 192.168.11.133

```

iSNS

This setting enables(on)/disables(off) iSNS.

```
Example:
tgtadm --op update --mode sys --name iSNS --value On

```

iSNSServerPort

This setting specifies the port to use for iSNS.

```
Example:
tgtadm --op update --mode sys --name iSNSServerPort --value 3205

```

iSNSAccessControl

Enable/disable access control for iSNS.

```
Example:
tgtadm --op update --mode sys --name iSNSAccessControl --value Off

```

## SEE ALSO
tgtd(8), tgt-admin(8), tgtimg(8), tgt-setup-lun(8). https://github.com/fujita/tgt

## REPORTING BUGS
Report bugs to <stgt@vger.kernel.org>


tgtd

title: tgtd(8)

summary: The SCSI Target Daemon

text:
# tgtd(8)

## NAME
tgtd - The SCSI Target Daemon

## SYNOPSIS
tgtd

tgtd [-C --control-port <INTEGER>] [-d --debug <INTEGER>] [-f --foregound] [-h --help] [--iscsi <...>]

## DESCRIPTION
Tgtd is a SCSI Target daemon. It can be used to provide SCSI target service to a network. The most common service is iSCSI but other services are also supported.

## DEVICE TYPES
Tgtd provides support for both emulated and passthrough of real devices.

```
    Tgtd can emulate the following types of devices:

    disk       : Normal disk device. Emulates a SCSI harddisk.

    tape       : Tape device. Emulates a SCSI tape drive.

    cd         : CD device. Emulates a SCSI DVD burner.

    changer    : Media changer. Emulate the changer device for a virtual tape library or DVD jukebox.

```

## OPTIONS
-d --debug <INTEGER>

Set to non-zero value to activate additional debugging messages to be logged.

-f --foreground

Run the daemon in the foreground.

-h --help

Print help text to the screen.

-C --control-port <INTEGER>

This comamnd is used to specify the control port to use for this instance of tgtd. This allows to run multiple instances of TGTD on a host. TGTADM has a matching argument to control which instance to connect to.

--iscsi <...>

ISCSI specific options. See the ISCSI section below for options specific to this frontend.

## ISCSI OPTIONS
These parameters apply only to the iSCSI frontend.

### portal=<ip-address[:port]>
This option is used to bind tgtd to a specific ip-address/portal and/or port. By default tgtd will bind to port 3260 on the wildcard address. The ip-address part (before the ":") can be missing to designate the wildcard address with a none-default port.

Example: to bind tgtd to a specific address and port

```
	tgtd --iscsi portal=192.0.2.1:3260

```

Example: to bind tgtd to any address but a none-default port

```
	tgtd --iscsi portal=:3251

```

### nop_interval=<integer>
This sets the default interval for sending NOP-OUT to probe for connected initiators. This parameter only controls the default value for targets. Individual targets can be controlled using tgtadm.

The default value is 0 which means that the feature is disabled TGTD will not send any NOP-OUT probes.

### nop_count=<integer>
This sets the default value for after how many failed probes TGTD will consider the initiator dead and tear down the session. This parameter only controls the default value for targets. Individual targets can be controlled using tgtadm.

The default value is 0.

Example: send NOP-OUT every 5 seconds and abort the session after 6 failures.

```
	tgtd --iscsi portal=192.0.2.1:3260,nop_interval=5,nop_count=6

```

## ENVIRONMENT VARIABLES

### TGT_IPC_SOCKET=<path>
When set tgtd and tgtadm will use the specified path as the IPC socket instead of the default '/var/run/tgtd/socket.0'

## SEE ALSO
targets.conf(5), tgtadm(8), tgt-admin(8), tgtimg(8), tgt-setup-lun(8). https://github.com/fujita/tgt

## COPYRIGHT/LICENSE

```
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see http://www.gnu.org/licenses/.
```


tgtimg

title: tgtimg(8)

text:
# tgtimg(8)

## NAME
tgtimg - Linux SCSI Target Framework Image File Utility

## SYNOPSIS
tgtimg [-o --op <operation>] [-Y --device-type <device-type>] [-b --barcode <barcode>] [-s --size <size>] [-t --type <media-type>] [-f --file <path>] [-T --thin-provisioning]

tgtimg --help

## DESCRIPTION
Tgtimg is a utility to create and manage the image files used by the TGTD device emulation.

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.

## OPTIONS
-h, --help

Show a help screen and exit.

-o, --op {new|show}

Operation. Is either new to create a new image file or show to show the content of an existing image file.

-Y, --device-type <type>

This specifies the type of image file.

```
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

```

-t, --type <media-type>

When creating a new image, this specifies the type of media to emulate. The available mediatypes depend on the type of the device.

```
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

```

-b, --barcode <barcode>

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.

-s, --size <size>

When creating a new image, this specifies the size in megabytes for the virtual tape image.

-f, --file <path>

The filename of the image file.

-T, --thin-provisioning

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. 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.

Thin-provisioning uses FALLOC_FL_PUNCH_HOLE which is only available on some linux filesystems. Thin-provisioning can only be used for DISK images.

## EXAMPLES
To create a new 100MByte disk

```
      tgtimg --op new --device-type disk --type disk --size 100 --file /data/hd001.raw

```

To create a new tape image

```
      tgtimg --op new --device-type tape --barcode 12345 --size 100 --type data --file /data/tape001.img

```

To view the content of an existing image

```
      tgtimg --op show --device-type tape --file /data/tape001.img

```

To create a new blank DVD+R image

```
      tgtimg --op new --device-type cd --type dvd+r --file /data/dvd001.iso

```

## SEE ALSO
tgtd(8), tgtadm(8), tgt-admin(8), tgt-setup-lun(8). https://github.com/fujita/tgt

## REPORTING BUGS
Report bugs to <stgt@vger.kernel.org>


package: sdparm

title: sas_disk_blink(8)

summary: blink the LED on a SAS disk

text:
# sas_disk_blink(8)

## NAME
sas_disk_blink - blink the LED on a SAS disk

## SYNOPSIS
sas_disk_blink [--help] [--set NUM] [--verbose] DEVICE

## DESCRIPTION
This bash shell script attempts to blink the LED on the SAS disk referred to by DEVICE. By default the LED will blink for 30 seconds. This is meant to help identify which disk corresponds to a given DEVICE.

The script use the sdparm utility and manipulates the "Ready LED Meaning" (RLM) field in the Protocol specific port mode page in order to blink the LED.

## OPTIONS
Arguments to long options are mandatory for short options as well.

-h, --help

print out the usage message then exit.

-s, --set NUM

when NUM is 0 then the RLM field is cleared. When NUM is 1 then the RLM field is set. When NUM > 1 then the SAS disk LED is made to blink for NUM seconds. If this option is not given then the SAS disk LED is made to blink for 30 seconds.

-v, --verbose

increase level or verbosity.

## EXIT STATUS
The exit status of this script is 0 when it is successful. Otherwise the exit status is that of the last sdparm utility called. See the sdparm(8) man page.

## AUTHORS
Written by D. Gilbert

## COPYRIGHT
Copyright © 2013-2016 Douglas Gilbert

This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO
sdparm (sdparm)


title: scsi_ch_swp(8)

text:
# scsi_ch_swp(8)

## NAME
scsi_ch_swp - change SCSI Software WRITE Protect and block device settings

## SYNOPSIS
scsi_ch_swp [--help] [--set 0|1] [--verbose] [--wr] BLK_DEVICE

## DESCRIPTION
This bash shell script attempts to read or change the Software Write Protect (SWP) bit in the SCSI Control mode page using the sdparm utility. If that change is successful then it uses the blockdev utility to change BLK_DEVICE's read-write or read-only setting in sympathy. This script is only available in Linux since the blockdev utility is Linux specific.

If changing the SWP bit is supported, setting the SWP bit makes BLK_DEVICE read-only at the device (disk) itself. Clearing the SWP bit makes BLK_DEVICE read-write which is usually the default setting at device (disk) power up.

If no options are given then the current state of the SWP bit is printed out (using sdparm) together with blockdev's RO bit. If they are both 1 then BLK_DEVICE is in read-only mode; if they are both 0 then BLK_DEVICE is in read-write mode.

## OPTIONS
Arguments to long options are mandatory for short options as well.

-h, --help

print out the usage message then exit.

-s, --set 0|1

when 0 is given then the SWP bit in the Control mode page is cleared (i.e. set that bit to 0) using sdparm; and blockdev is used to set BLK_DEVICE to read-write mode. When 1 is given then the SWP bit in the Control mode page is set using sdparm; and blockdev is used to set BLK_DEVICE to read-only mode. The default (i.e. when this option is not given) is to read the state of the SWP bit and BLK_DEVICE's read-only mode and print those values out.

-v, --verbose

increase level or verbosity.

-w, --wr

when the BLK_DEVICE is in read-only mode, Linux will not typically allow BLK_DEVICE to be opened read-write by sdparm, so the default action of this script is to use the sdparm --readonly option when --set 0 has been invoked. It is possible that BLK_DEVICE could be a generic device (e.g. /dev/sg3) which has a different interpretation of the read-only open flag and may fail. For such rare cases the --wr option makes sdparm open BLK_DEVICE read-write when --set 0 is invoked.

## EXIT STATUS
The exit status of this script is 0 when it is successful. Otherwise the exit status is that of the sdparm or the blockdev utility, whichever is called last. See the sdparm(8) man page.

## AUTHORS
Written by D. Gilbert

## COPYRIGHT
Copyright © 2013 Douglas Gilbert

This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO
sdparm(sdparm), blockdev(8)