USB SCSI Disconnects when Idle

Problem: An external USB harddrive disconnects and immediately reconnects with different device name. You find log entries like these:

Jan 17 00:46:52 workstation kernel: [212306.086568] sd 33:0:0:0: [sdj] Attached SCSI disk
Jan 17 01:51:14 workstation kernel: [216168.064075] usb 2-4: USB disconnect, device number 11
Jan 17 01:51:15 workstation kernel: [216168.596514] usb 2-4: new SuperSpeed USB device number 12 using xhci_hcd
Jan 17 01:51:16 workstation kernel: [216169.613657] sd 34:0:0:0: Attached scsi generic sg7 type 0
Jan 17 01:51:51 workstation kernel: [216169.616792] sd 34:0:0:0: [sdg] Spinning up disk........
Jan 17 01:51:52 workstation kernel: [216205.941531] sd 34:0:0:0: [sdg] Attached SCSI disk

This happens especially when the drive is idle.

Solution: This seems to be related to the SCSI standby feature which is enabled on new drives per default. You can disable this “feature” with:

sdparm -S -c STANDBY /dev/sdg

“-c STANDBY” clear STANDBY flag.
“-S” save for next power cycle
“/dev/sdg” device name of the usb harddrive

Tested with: Debian 7.0, WD Elements USB 3.0 harddisk.