1

I'm on Ubuntu 14.04LTS. Gnome-disk-utility has a button which invokes the scsi start stop unit command on a selected device. I'd like to invoke scsi stop for a device (in my case an empty SD-card adapter for micro-SD which I always leave in its slot) in a script/one line command so my system stops probing the empty adapter.

Gnome-disks depends on udisks and other modules for its functions. I'm trying to find which package is responsible for scsi calls and how I can invoke this outside of gnome-disks-gui (preferably without installing other packages).

Any ideas anyone?

Olove
  • 61

2 Answers2

1

You can use sg_start, which can be found in the sg3utils package:

sudo apt-get update && sudo apt-get install sg3utils
kos
  • 41,268
0

I looked further and found the answer to my own question.

When looking at my syslog i noticed that the module responsible for the command was udisksd which has a control utility udisksctl supporting the command power-off [options]. Since the action to be taken on power-off differs for different devices (sd*, hd* etc.) it parses the necessary commands automagicly sourcing the right library which for SCSI would be libsgutils2-2 i assume. So installing other packages is not necessary for just this function. Since you can not rely on /dev/sd* to always pick the right device use something like /dev/disk/by-id/

My command-line became: $ udisksctl power-off --block-device /dev/disk/by-id/usb-Generic-_Multi-Card_20090516388200000-0\:0

When reinserting the adapter it gets detected and started automaticly

Olove
  • 61