Doesn't detect usb flash drive as SSD

Bug #499237 reported by Orson Jones
34
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Linux
New
Medium
Unassigned
linux (Ubuntu)
Incomplete
Medium
Unassigned

Bug Description

I installed Ubuntu 9.10 on a 4G usb flash drive, performed updates as of 19 Dec 2009, and installed bootchart.

The bootchart showed ureadahead as blocking the boot sequence while it did the readahead (Spinning drive style) instead of doing readahead in the background as I was expecting for a SSD.

Tags: quantal
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Please supply the output of "sudo ureadahead --dump"

Changed in ureadahead:
status: New → Incomplete
importance: Undecided → Medium
Revision history for this message
Orson Jones (orson-launchpad) wrote :
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

And also "cat /sys/block/sdb/queue/rotational"

Thanks

Revision history for this message
Orson Jones (orson-launchpad) wrote :

$ cat /sys/block/sdb/queue/rotational
1

Revision history for this message
Orson Jones (orson-launchpad) wrote :

After reading up on how /sys/block/*/queue/rotational works, It looks like it doesn't always detect SSD drives as such. I think the best course of action for the time being would be to find out how to manually set /sys/block/sdx/queue/rotational to 0 for drives that the user knows to be SSD type drives. (before ureadahead starts) If that isn't feasable, perhaps add a configuration option to force ureadahead to do it one way or the other.

Revision history for this message
Orson Jones (orson-launchpad) wrote :

I added a pre-start script to the ureadahead.conf init script.
It does change the rotational setting for the drive, but doesn't seem to affect the behavior of ureadahead

I'm not an expert on how the init system works, so it could be that it isn't setting it early enough even though it looks like it should to me.

Revision history for this message
Orson Jones (orson-launchpad) wrote :

Oh, you are also the maintainer for upstart. I'll let you figure out why that didn't fix/workaround it then.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote : Re: [Bug 499237] Re: Doesn't detect usb flash drive as SSD

On Thu, 2009-12-24 at 07:34 +0000, Orson Jones wrote:

> I added a pre-start script to the ureadahead.conf init script.
> It does change the rotational setting for the drive, but doesn't seem to affect the behavior of ureadahead
>
Did you remove the pack file first?

Scott
--
Scott James Remnant
<email address hidden>

Revision history for this message
Orson Jones (orson-launchpad) wrote :

I ran through it again just to make sure. Delete the pack, make sure I was using the modified ureadahead.conf init script, then reboot twice, and giving it a few minutes of idle at the desktop to make sure everything was settled.

It still blocks the boot sequence with the modified ureadahead.conf

Revision history for this message
Orson Jones (orson-launchpad) wrote :

Here is the pack file from my most recent test

Revision history for this message
Orson Jones (orson-launchpad) wrote :

bootchart from first boot of most recent test

Revision history for this message
Orson Jones (orson-launchpad) wrote :

bootchart from second boot of most recent test

Revision history for this message
Orson Jones (orson-launchpad) wrote :

I tried modifying the source to force it to do it ssd style.

=== modified file 'src/pack.c'
--- src/pack.c 2010-01-21 04:31:20 +0000
+++ src/pack.c 2010-01-21 04:32:13 +0000
@@ -675,11 +675,7 @@
  if (setrlimit (RLIMIT_NOFILE, &nofile) < 0)
   nih_return_system_error (-1);

- if (file->rotational) {
- return do_readahead_hdd (file, daemonise);
- } else {
   return do_readahead_ssd (file, daemonise);
- }
 }

That does work, but is obviously not the way to handle it. So, somehow it is not getting the setting from the pre-start script to that part of the code.

Revision history for this message
Orson Jones (orson-launchpad) wrote :

I just checked this with the Lucid Beta1. I need to do a few more checks, but it looks the same so far.

Revision history for this message
Orson Jones (orson-launchpad) wrote :

So, with beta1, it still has the same behavior. With, or without the modified ureadahead.conf it behaves as if it were a rotational drive.

Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Moved to Ubuntu bug tracker

Changed in ureadahead (Ubuntu):
status: New → Incomplete
Changed in ureadahead:
status: Incomplete → Invalid
Changed in ureadahead (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

This should be moved over to the kernel - since the rotational flag is wrong for this drive.

As to why the pre-start script you tried to override it didn't work, could you post the output of "mount" for me so I can test your sed script? I have a feeling you may be accidentally trying to toggle the partition or something

affects: ureadahead (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
status: Incomplete → Triaged
Revision history for this message
gsch (gcscheepers) wrote :
Download full text (4.0 KiB)

My external SSD has also become a brick. My Acer travelmate 2450 has an IDE harddrive which I decided to replace with an external usb Kingston SSD drive. I cloned the IDE drive to the new SSD. I decided to remove the native IDE drive since I could not get into the BIOS to change the boot sequence to USB first. Started up the computer with only the usb drive attached and it worked beautifully for a week since I always plugged the drive into the same USB bus. Footnote: I'm still on Jaunty, Karmic would not boot up for me.

Then I moved the drive to a different usb bus before startup and the system does not boot up anymore, even when attached to the original usb bus. Says "operating system not found". Popped in a live cd, but can't mount the SSD drive. Booted up with the old IDE drive and still can't mount the SSD drive. I also can not see it with fdisk -l.

The output of dmesg:

[ 1216.260881] end_request: I/O error, dev sdb, sector 24
[ 1216.260930] sd 3:0:0:0: [sdb] Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK,SUGGEST_OK
[ 1216.260935] end_request: I/O error, dev sdb, sector 0
[ 1216.260983] sd 3:0:0:0: [sdb] Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK,SUGGEST_OK
[ 1216.260988] end_request: I/O error, dev sdb, sector 0
[ 1216.260995] unable to read partition table
[ 1216.262595] sd 3:0:0:0: [sdb] Attached SCSI disk
[ 1216.262695] sd 3:0:0:0: Attached scsi generic sg2 type 0
[ 1223.884102] usb 1-1: new high speed USB device using ehci_hcd and address 4
[ 1224.049713] usb 1-1: configuration #1 chosen from 1 choice
[ 1224.050103] scsi4 : SCSI emulation for USB Mass Storage devices
[ 1224.050625] usb-storage: device found at 4
[ 1224.050628] usb-storage: waiting for device to settle before scanning

After settling, dmesg says:
[ 1705.545548] sd 4:0:0:0: [sdb] Add. Sense: No additional sense information
[ 1705.550804] sd 4:0:0:0: [sdb] Sense Key : No Sense [current]
[ 1705.550810] Info fld=0x0

lsusb gives:
Bus 001 Device 004: ID 13fd:1840 Initio Corporation
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

ls -lrt /dev/disk/by-id:

total 0
lrwxrwxrwx 1 root root 9 2010-03-28 16:04 ata-HTS541060G9AT00_MP27MBXDG62DYH -> ../../sda
lrwxrwxrwx 1 root root 10 2010-03-28 16:04 ata-HTS541060G9AT00_MP27MBXDG62DYH-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2010-03-28 16:04 ata-HTS541060G9AT00_MP27MBXDG62DYH-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2010-03-28 16:04 ata-HTS541060G9AT00_MP27MBXDG62DYH-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 2010-03-28 16:04 ata-HTS541060G9AT00_MP27MBXDG62DYH-part6 -> ../../sda6
lrwxrwxrwx 1 root root 9 2010-03-28 16:05 scsi-SATA_HTS541060G9AT00_MP27MBXDG62DYH -> ../../sda
lrwxrwxrwx 1 root root 10 2010-03-28 16:05 scsi-SATA_HTS541060G9AT00_MP27MBXDG62DYH-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2010-03-28 16:05 scsi-SATA_HTS541060G9AT00_MP27MBXDG62DYH-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2010-03-28 16:05 scsi-SATA_HTS541060G9AT00_MP27MBXDG62DYH-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 2010-03-28 16:05 scsi-SATA_HTS541060G9AT00_MP27MBXDG62DYH-part...

Read more...

Revision history for this message
Orson Jones (orson-launchpad) wrote :

$ mount
/dev/sdb1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
gvfs-fuse-daemon on /home/orson/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=orson)
$ cat /sys/block/sdb/queue/rotational
0

It looks like it doesn't work when using usb. I tried it on a regular internal drive and I can force it to do either ssd or spinning style boot using the pre-start script.

Also, how would you do debugging during the pre-start script? I tried echoing some stuff to a temp file, but it caused ureadahead to not start.

Revision history for this message
Orson Jones (orson-launchpad) wrote :

I tried this again with the latest 10.10 version of Ubuntu. This behavior still exists.

Using a simplified version of the pre-start script (below) produces the same (undesired) ureadahead behavior.

# set root drive to be ssd status
pre-start script
 echo "0" > /sys/block/sdb/queue/rotational
end script

Revision history for this message
ggonlp (oktobermann) wrote :

This problem continues to exists also with the latest 64bit 2.6.35-27. I am booting ubuntu 10.10 from an SD card which the kernel also incorrectly identifies as a rotational device. After resetting it to 0 and just like Orson not getting the desired result, I tried to cheat my way through by running ureadahead in parallel to the boot process. Normally ureadahead.conf will block mountall (and hence pretty much everything else), but if you modify it like that:

exec /sbin/ureadahead --daemon &

it will run ureadahead in parallel (or at least bootchart says so) - but the result is worse than without ureadahead at all.

Revision history for this message
Marius B. Kotsbak (mariusko) wrote :

Still wrong for one of my memory sticks in the latest Quantal:
cat /sys/block/sdb/queue/rotational
1

tags: added: quantal
Revision history for this message
penalvch (penalvch) wrote :

Orson Jones, this bug was reported a while ago and there hasn't been any activity in it recently. We were wondering if this is still an issue? If so, could you please test for this with the latest development release of Ubuntu? ISO images are available from http://cdimage.ubuntu.com/daily-live/current/ .

If it remains an issue, could you please run the following command in the development release from a Terminal (Applications->Accessories->Terminal), as it will automatically gather and attach updated debug information to this report:

apport-collect -p linux <replace-with-bug-number>

Also, could you please test the latest upstream kernel available following https://wiki.ubuntu.com/KernelMainlineBuilds ? It will allow additional upstream developers to examine the issue. Please do not test the daily kernel folder, but the one all the way at the bottom. Once you've tested the upstream kernel, please comment on which kernel version specifically you tested. If this bug is fixed in the mainline kernel, please add the following tags:
kernel-fixed-upstream
kernel-fixed-upstream-VERSION-NUMBER

where VERSION-NUMBER is the version number of the kernel you tested. For example:
kernel-fixed-upstream-v3.11.1

This can be done by clicking on the yellow circle with a black pencil icon next to the word Tags located at the bottom of the bug description. As well, please remove the tag:
needs-upstream-testing

If the mainline kernel does not fix this bug, please add the following tags:
kernel-bug-exists-upstream
kernel-bug-exists-upstream-VERSION-NUMBER

As well, please remove the tag:
needs-upstream-testing

Once testing of the upstream kernel is complete, please mark this bug's Status as Confirmed. Please let us know your results. Thank you for your understanding.

affects: ureadahead → linux
Changed in linux:
status: Invalid → New
Changed in linux (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Néher Márton (neher-marton) wrote :

I am using Ubuntu 14.04, and the problem is still present.

And I think this issue may start to gain relevance, since USB 3.0 attached SSDs are starting to appear, and BTRFS to check this parameter for applying SSD mount option.

For me, the situation is what I described above, usb3 attached ssd, with my system booting from it, and it is still considered to be rotational.

Revision history for this message
penalvch (penalvch) wrote :

Néher Márton, thank you for your comment. So your hardware and problem may be tracked, could you please file a new report with Ubuntu by executing the following in a terminal while booted into the default Ubuntu kernel (not a mainline one) via:
ubuntu-bug linux

For more on this, please read the official Ubuntu documentation:
Ubuntu Bug Control and Ubuntu Bug Squad: https://wiki.ubuntu.com/Bugs/BestPractices#X.2BAC8-Reporting.Focus_on_One_Issue
Ubuntu Kernel Team: https://wiki.ubuntu.com/KernelTeam/KernelTeamBugPolicies#Filing_Kernel_Bug_reports
Ubuntu Community: https://help.ubuntu.com/community/ReportingBugs#Bug_reporting_etiquette

When opening up the new report, please feel free to subscribe me to it.

Thank you for your understanding.

Helpful bug reporting tips:
https://wiki.ubuntu.com/ReportingBugs

Revision history for this message
Marius B. Kotsbak (mariusko) wrote :

I guess this might not be fixable at all. Getting spin speed/SSD or not is done with this command (see http://comments.gmane.org/gmane.linux.kernel.bcache.devel/554):

$ sudo hdparm -I /dev/sda|grep Rot
 Nominal Media Rotation Rate: Solid State Device

This is my internal SSD hard drive. I tried with a rotational hard drive attached with USB, but get no information about that. Same with a USB memory stick. This leads me to believe that it is not possible to detect if a USB connected drive is SSD or not, and the kernel assumes rotational drive as default.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.