s2p

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
SEE ALSO

NAME

s2p − Emulates SCSI and SASI devices with the Raspberry Pi

SYNOPSIS

s2p [−-scsi-id/-i n[:u] SCSI_IMAGE_FILE] [−-sasi-id/-h n[:u] SASI_IMAGE_FILE] [−-type/-t TYPE] [−-scsi-level SCSI_LEVEL] [−-name/-n VENDOR:PRODUCT:REVISION] [−-block-size/-b BLOCK_SIZE] [−-caching-mode/-m CACHING_MODE] [−-blue-scsi-mode/-B] [−-reserved-ids/-r RESERVED_IDS] [−-image-folder/-F IMAGE_FOLDER] [−-scan-depth/-R SCAN_DEPTH] [−-property/-c KEY=VALUE] [−-property-files/-C PROPERTY_FILES] [−-ignore-conf] [−-log-level/-L LOG_LEVEL[:ID:[LUN]]] [−-log-pattern/-l LOG_PATTERN] [−-token-file/-P ACCESS_TOKEN_FILE] [−-port/-p PORT] [−-locale,-z LOCALE] [−-version/-v] [−-help]

DESCRIPTION

s2p emulates SCSI and SASI devices with the Raspberry Pi and a PiSCSI/RaSCSI board.

In the arguments to s2p one or more SCSI (-i n[:u]) or SASI (-h n[:u]) devices can be specified. SCSI and SASI devices cannot be mixed on the same controller. The number (n) after the device identifier specifies the ID number for that device. The optional number (u) specifies the LUN (logical unit) for that device. The default LUN is 0. The ID is limited from 0-7. However, typically SCSI ID 7 is reserved for the "initiator" (the host computer). The LUN is limited from 0-31 for SCSI and 0-1 for SASI.

If no explicit device type is provided, s2p determines the type based upon the file extension of the FILE argument.
hd1: SCSI Hard Disk image (generic, non-removable, SCSI-1)
hds: SCSI Hard Disk image (generic, non-removable, SCSI-2)
hdr: SCSI Hard Disk image (generic, removable, SCSI-2)
hda: SCSI Hard Disk image (Apple compatible - typically used with Macintosh computers, but also compatible with any other, SCSI-2)
mos: SCSI Magneto-Optical image (MO/MOD, SCSI-2)
is1: SCSI CD-ROM or DVD-ROM image (ISO 9660, SCSI-1)
iso, cdr, toast: SCSI CD-ROM or DVD-ROM image (ISO 9660, SCSI-2)

For example, if you want to specify an Apple-compatible HD image on ID 0, you can use the following command:
s2p -id 0 /path/to/drive/hdimage.hda

When s2p starts it opens a socket (default port is 6868) to allow external management commands. Examples for management tools are s2pctl or the SCSI Control app.

To quit s2p press Control-C. If it is running in the background, you can kill it using an INT signal. When terminating s2p automatically flushes all cached data.

OPTIONS

--blue-scsi-mode/-B

Enable BlueSCSI filename parsing compatibility mode for the respective device. In this mode the name of an image file is parsed based on the BlueSCSI parsing rules. This mode is useful in order to share drive images between SCSI2Pi and BlueSCSI. If there are SCSI2Pi command line options for the respective device they will override the settings derived from the filename. If there is an additional text before the filename extension s2p tries to parse this text as INQUIRY product data.

--scsi-id/-i n[:u] FILE

n is the SCSI ID (0-7). u (0-31) is the optional LUN (logical unit). The default LUN is 0.

FILE is the name of the image file to use for the SCSI device. For devices that do not support an image file the filename may have a special meaning or a dummy name can be provided. For SCDP it is an optional prioritized list of network interfaces, an optional IP address and netmask, e.g. "interface=eth0,eth1,wlan0:inet=10.10.20.1/24". For SCLP it is the print command to be used and a reservation timeout in seconds, e.g. "cmd=lp -oraw %f:timeout=60".

--sasi-id/-h n[:u] FILE

n is the SASI ID (0-7). u (0-1) is the optional LUN (logical unit). The default LUN is 0.

FILE is the name of the image file to use for the SASI hard drive.

--type/-t TYPE

The optional case-insensitive device type (SAHD, SCHD, SCRM, SCCD, SCMO, SCDP, SCLP, SCHS). If no type is specified for devices that support an image file, s2p tries to derive the type from the file extension.

--scsi-level TYPE

The optional SCSI standard level. The default level is device-specific and usually is SCSI-2. Be careful with using this option, you will usually not need it. Explicitly setting the level may be required for drives with removable media if they are attached without providing an image file. In this case the SCSI-1-CCS level cannot be derived from the ".is1" or ".hd1" filename extension and "--scsi-level 1" can be used.

--name/-n VENDOR:PRODUCT:REVISION

Set the optional vendor, product and revision for the device, to be returned with the INQUIRY data. A complete set of name components must be provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up to 4 characters. Padding with blanks to the maxium length is automatically applied. Once set the name of a device cannot be changed.

--block-size/-b BLOCK_SIZE

The optional sector size, usually 256 (SASI only), 512, 1024, 2048 or 4096 bytes. The default size for SASI hard drives is 256 bytes, for SCSI hard drives it is 512 bytes. s2p supports non-standard SCSI hard drive sector sizes as long as they are multiples of 4, but these sizes are only required for exotic platforms. Note that image file sizes must be a multiple of 512.

--caching-mode/-m CACHING_MODE

Caching mode (piscsi|write-through|linux|linux-optimized), default currently is PiSCSI compatible caching.

--reserved-ids/-r RESERVED_IDS

An optional comma-separated list of IDs to reserve. Pass an empty list in order to not reserve any ID.

--image-folder/-F FOLDER

The default folder for image files. For files in this folder no absolute path needs to be specified. The default folder is ’˜/images’ except for the root user. In this case, for backwards compatibility with PiSCSI the default is ’/home/pi/images’.

--scan-depth/-R SCAN_DEPTH

Scan for image files recursively, up to a depth of SCAN_DEPTH. Depth 0 means to ignore any folders within the default image folder. Be careful when using this option with many sub-folders in the default image folder. The default depth is 1.

--property- KEY=VALUE

Set the s2p configuration property with the name KEY to the value VALUE. Properties set with this option override properties from property files.

--property-files/-C PROPERTY_FILES

An optional comma-separated list of property files with s2p configuration data. The default global property file is /etc/s2p.conf. This file is parsed first. The optional local default property file is ˜/.config/s2p.conf. Definitions in this file and in explicitly specified property files override the previously defined properties.

--ignore-conf

Ignore any properties in the global configuration file /etc/s2p.conf and the local property file ˜/.config/s2p.conf.

--log-level/-L LOG_LEVEL[:ID:[LUN]]

The s2p log level (trace, debug, info, warning, error, critical, off). The default log level is ’info’ for all devices unless a device ID and an optional LUN is provided when setting the level.

--log-pattern/-l LOG_PATTERN

The spdlog pattern to use for logging. See https://github.com/gabime/spdlog for details.

--token-file/-P ACCESS_TOKEN_FILE

Enable authentication and read the access token from the specified file. The access token file must be owned by root and must be readable by root only.

--port/-p PORT

The s2p client service port, default is 6868.

--locale/-z LOCALE

Overrides the default locale (language) for client-facing error messages. A client can override this setting.

--version/-v

Displays the s2p version.

--help

Displays a help page.

EXAMPLES

Launch s2p with no devices attached:
s2p

Launch s2p with an Apple hard drive image as ID 0 and a CD-ROM as ID 2
s2p -i 0 /path/to/harddrive.hda -i 2 /path/to/cdimage.iso

Launch s2p with a removable SCSI drive image as ID 0 and the raw device file /dev/hdb (e.g. a USB stick) and a DaynaPort network adapter as ID 6:
s2p -i 0 -t scrm /dev/hdb -i 6 daynaport

Launch s2p with a SASI hard drive image as ID 1
s2p -h 1 /path/to/harddrive.hds

To create an empty 100 MiB drive image, use the following command:
dd if=/dev/zero of=/path/to/newimage.hda bs=512 count=204800

In case the fallocate command is available a much faster alternative to the dd command is:
fallocate -l 104857600 /path/to/newimage.hda

SEE ALSO

s2pctl(1), s2pdump(1), s2pexec(1), s2pproto(1)

Also see <https://www.scsi2pi.net> and <https://github.com/uweseimet/scsi2pi>.