Bug 90761 - USB stick show as rotational disk
Summary: USB stick show as rotational disk
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Flash/Memory Technology Devices (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: David Woodhouse
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-04 09:08 UTC by chepioq
Modified: 2019-05-28 11:08 UTC (History)
3 users (show)

See Also:
Kernel Version: 3.17.7-300.fc21.x86_64
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description chepioq 2015-01-04 09:08:28 UTC
I have a ssd on my laptop, and it show that not rotational:

[dominique@host-192-168-1-2 ~]$ cat /sys/block/sda/queue/rotational
0

and it's normal.
But with usb stick I have :
[dominique@host-192-168-1-2 ~]$ cat /sys/block/sdb/queue/rotational
1

that mean usb's stick is shown as rotational disk, and it's not normal.

This problem is present on fedora and ubuntu, and I think it's a kernel problem.

Fedora subject : http://forums.fedora-fr.org/viewtopic.php?id=63254

Ubuntu subject : https://bugs.launchpad.net/linux/+bug/499237

Say me if you want another precision.
Comment 1 chepioq 2015-01-11 07:56:15 UTC
Anybody here ?
Comment 2 Marcos Souza 2019-05-27 03:18:34 UTC
I can reproduce the behavior in a recent kernel:

cat /sys/block/sdc/queue/rotational
1
cat /sys/block/sdc/device/model 
Cruzer Blade    

Looking at the kernel code related SCSI (created by usb-storage module), it first unsets the NONROT flag (leaving it as rotational)[1], letting to be checked by vpd[2]. In my test, my usb storage devices does not have bdc (Block Device Characteristics):

sudo /usr/bin/sg_vpd --page 0x0 /dev/sdc
[sudo] password for root: 
Supported VPD pages VPD page:
  Supported VPD pages [sv]
  Unit serial number [sn]
  Device identification [di]

For example, take a look of the info reported when checking a SSD device which have VPD BDC support:
sudo /usr/bin/sg_vpd --page 0x0 /dev/sda
Supported VPD pages VPD page:
  Supported VPD pages [sv]
  Unit serial number [sn]
  Device identification [di]
  ATA information (SAT) [ai]
  Block limits (SBC) [bl]
  Block device characteristics (SBC) [bdc] <---- bdc support
  Logical block provisioning (SBC) [lbpv]

sudo /usr/bin/sg_vpd --page 0xb1 /dev/sda
Block device characteristics VPD page (SBC):
  Non-rotating medium (e.g. solid state) <---- Non rotating...
  Product type: Not specified
  WABEREQ=0
  WACEREQ=0
  Nominal form factor not reported
  ZONED=0
  RBWZ=0
  BOCS=0
  FUAB=0
  VBULS=0
  DEPOPULATION_TIME=0 (seconds)


I will check SCSI specialists if this can be clarified at code level.

[1]: https://github.com/torvalds/linux/blob/master/drivers/scsi/sd.c#L3123
[2]: https://github.com/torvalds/linux/blob/master/drivers/scsi/sd.c#L2931
Comment 3 Marcos Souza 2019-05-28 11:08:06 UTC
Currently, there is no way to distinguish if an USB that don't have VPD is a flash disk, because VPD BDC is used. USB sticks that have VPD BDC should be set as not rotational as expected. So it's a known issue, but so far there is no way to fix it.

Note You need to log in before you can comment on or make changes to this bug.