Hot answers tagged

23

SCSI is not only a type of hardware interface, but also a command protocol, which is used for abstraction of most of the modern storage devices. Linux scsi driver is a high level driver that handles a variety of storage hardware. Protocol: http://en.wikipedia.org/wiki/SCSI_command Extract from SCSI on wikipedia: Other technologies which use the SCSI ...


15

Usb devices are far more complex than simply pipes you read and write. You'll have to write code to manipulate them. You don't need to write a kernel driver. See http://libusb.info (née libusb.org) and http://libusb.sourceforge.net/api-1.0. This claims to work with Linux, OSX, Windows, Android, OpenBSD, etc. Under Mac OS X there are user-level functions in I/...


13

After cycling around /sys for a while, I found this solution: # echo /sys/class/enclosure/*/*/device/block/sdaa /sys/class/enclosure/2:0:35:0/Slot 15/device/block/sdaa # echo 1 > '/sys/class/enclosure/2:0:35:0/Slot 15/locate' Or: # echo 1 > /sys/class/enclosure/*/*/device/block/sdaa/../../enclosure*/locate To blink all detected devices: parallel ...


11

Ok, I think I've worked this out. TL;DR Use dd with a large block size to read from the tape instead: dd if=/dev/nst0 bs=1M | tar tvf - Background When you write to tapes, the data is written in units called blocks. These are like sectors on a hard disk. Where hard disk blocks were fixed at 512-bytes for many years and only recently moved to 4096-byte ...


9

/dev/sgxx is a SCSI-generic device, which allows sending and receiving of raw SCSI commands. When you write to the device, you are expected to start the write with a SCSI header, which defines the operation you wish to do. Writing random data to an sg device is really a bad idea. You'll be sending random SCSI commands, which might not even exist (hence ...


9

Turns out that there's a 1 second timeout int drivers/usb/storage/usb.c. I enabled more debug-logging by typing the following two commands: echo 8 > /proc/sys/kernel/printk echo "module usb_storage +p" > /sys/kernel/debug/dynamic_debug/control echo 0xFFFFFF > /proc/sys/dev/scsi/logging_level The scsi subsystem has a weird (compared to the rest of ...


8

All block devices have a removable attribute, among other block device attributes. These attributes can be read from userland in sysfs at /sys/block/DEVICE/ATTRIBUTE, e.g. /sys/block/sdb/removable. You can query this attribute from a udev rule, with ATTR{removable}=="0" or ATTR{removable}=="1". Note that removable (the device keeps existing but may have ...


7

I don't have /proc/scsi/scsi on my system with 2.6.39.1 kernel. I would use 'lsscsi' command: ~> lsscsi -v [0:0:0:0] disk ATA ST3500418AS CC38 /dev/sda dir: /sys/bus/scsi/devices/0:0:0:0 [/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0] [1:0:0:0] disk ATA WDC WD2500KS-00M 02.0 /dev/sdb dir: /sys/bus/scsi/...


6

I think you can get what you want by cross referencing the output from lshw -c disk and this command, udevadm info -q all -n <device>. For example My /dev/sda device shows the following output for lshw: $ sudo lshw -c disk *-disk description: ATA Disk product: ST9500420AS vendor: Seagate physical id: 0 ...


6

Here's an approach that should work: Get the list of sdX devices to exclude exclude=$(cut -d/ -f3 exclude.txt) Iterate over the /sys/block/sdX directories: for sysfile in /sys/block/sd? ; do Extract the sdX name from that path, and build the delete file name dev=$(basename $sysfile) del=$sysfile/device/delete Check if that sdX is in the excluded ...


6

You can get the make and model of each physical block device with lsblk: $ lsblk -do +VENDOR,MODEL,SERIAL NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT VENDOR MODEL SERIAL sda 8:0 0 1.8T 0 disk ATA WDC WD20EARS-00M WD-WCAZA571XXXX sdf 8:80 0 465.1G 0 disk WD My Passport 070A WD-WXF1A30YXXXX sr0 11:0 ...


5

The MPTSCSIH-Driver Release Notes from LSI look interesting. Major Changes For Version 2.06.75.00-1 Release Date: 12/10/2007 General Changes Functionality • Task Aborts for commands to a Volume are returned as FAILED and not sent to FW. Which version is your driver? (modinfo mptscsih) Use this link for Seagate Firmware information about your Barracuda ...


5

Just my 2 cents... It is more than true that spinning down the disks decreases their service life. Years of experience have shown that starting and stopping the disk motor causes far more fatigue than 24/7 spin. All my disks with big start/stop count have reallocated sectors and all my disks that spin 10 years 24/7 are (believe it or not) good as new. After ...


5

This solution (for Linux) from http://www.arrfab.net/blog/?p=107 has helped for a 1TB Seagate Portable drive which kept going to sleep: # sdparm --clear=STANDBY /dev/sdc -S The drive now is immediately responsive even when left idle for an hour. Didn't test yet whether the setting is saved across restarts etc, though.


5

This answer checks the list of all attached block devices and iterates over them with udevadmin to check their respective ID_BUS. You can see all attached block devices in /sys/block. Here is the bash script from the linked answer that should let you know if it is a USB storage device: for device in /sys/block/* do if udevadm info --query=property --...


5

You can change the timeout by writing to /sys/module/usb_storage/parameters/delay_use. For older usb disks, a settle delay of 5 seconds or even more may be needed (and 5 was the default until it was reduced to 1 second in 2010), presumably because the controller is starved of power while the disk motors are initializing. Or possibly because the internal ...


5

They are the first four bytes in the buffer returned from a mode sense command (see drivers/scsi/sd.c, sd_mode_sense()). The meaning can be gleaned by looking at drivers/scsi/scsi_lib.c, scsi_mode_sense()): this routine returns a structure called "data" which, according to a comment, abstracts the mode header data; the first two bytes in the buffer (00 and ...


5

As no formatting program seems to exist, I wrote the following shell script which sends appropriate FORMAT UNIT commands to format all 80 tracks of a floppy disk. The device da0 is formatted unless a different device is supplied as an argument. The CDB has been taken from the UFI specification. #!/bin/sh set -e exec >&2 drive=${1:-da0} numblocks=...


4

cat /proc/scsi/scsi


4

You can use the links in /dev/disk/by-id: [root@krxl02cn05 by-id]# pwd /dev/disk/by-id [root@krxl02cn05 by-id]# ls -rtl total 0 lrwxrwxrwx 1 root root 9 Feb 12 01:40 scsi-3600605b005d8655019aa31faf0812bae -> ../../sda lrwxrwxrwx 1 root root 10 Feb 12 01:40 scsi-3600605b005d8655019aa31faf0812bae-part2 -> ../../sda2 lrwxrwxrwx 1 root root 10 Feb 12 01:...


4

An easy way to get the correspondence is to look at the device/block subdirectory in the /sys hierarchy: # ls -1d /sys/class/scsi_device/*/device/block/* /sys/class/scsi_device/1:0:0:0/device/block/sr0 /sys/class/scsi_device/2:0:0:0/device/block/sda /sys/class/scsi_device/2:0:1:0/device/block/sdb /sys/class/scsi_device/2:0:2:0/device/block/sdc /sys/class/...


4

The very high SCSI device numbers (scsi 0:0:90903:0) show that there's a problem in this case that the hardware keeps dropping & re-initializing the drive. The MPT SAS hardware does most of the re-initializing itself here, so we can't entirely control that from the Kernel. Separately, you mention having 21 drives, so they are probably behind one or more ...


4

It is possible that the buffering mode has been set to “unbuffered.” This is a special feature of LTO tape drives, forcing them to return from a WRITE command only after the data has been written to the tape. This stops any streaming from happening and causes the observed effects. Unfortunately FreeBSD does not provide the mt drvbuffer 1 command from Linux ...


4

More convenient way is to use lsscsi utility. From documentation about FC: For FC devices (logical units), the '--transport' option will show the port name and the port identifier instead of the SCSI INQUIRY "strings". For example: $ lsscsi -g [3:0:0:0] enclosu HP A6255A HP04 - /dev/sg3 [3:0:1:0] disk HP 36.4G ...


3

From this line in the log: st0: Sense Key : Medium Error [current] it looks like either the tape is damaged or dirty, or the drive head is dirty or misaligned or damaged. First thing to try is to run a cleaning tape through the drive, then try writing to that tape again. If you get media errors again, try writing to a known good tape, or to a brand new ...


3

From the SCSI2-Draft standard (the only one I have that isn't a PDF): Table D.1 (continued) +=============================================================================+ | D - DIRECT ACCESS DEVICE | | . .W - WRITE ONCE READ MULTIPLE DEVICE | | . . .O - ...


3

Proper SAS/SATA connectors are hot plug safe, so as long as you are using those connectors both for data and power ( not the usual PC molex power connector ) then you won't hurt anything plugging them in.


3

The message is quite clear: multiple SCSI errors occurred on sda, so sda2 can't be mounted as your root filesystem. It's likely that you have some sort of failure in the drive that your instance is attached to, most probably that the drive is dying. The way to solve this problem is to replace the drive with a working one, and restore from your backups.


3

With FreeBSD 9+ the camcontrol utility can be used to control if either a SATA or a SCSI drive is disconnected, or not, in such circumstances: camcontrol negotiate /dev/<dev> -D disable


3

Your HP C4738A drive is a DDS-5 tape drive, so you do have a tape drive in your server. You might get more details on the cause of the error you're getting from mt by looking at the output of dmesg. The HP Linux Tape Tools will probably come in handy...


Only top voted, non community-wiki answers of a minimum length are eligible