Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 543684 - gentoo-sources-3.19.2 and vanilla-sources-3.19.2: External USB 3 HDD: logical sector size incorrectly detected on first connect
Summary: gentoo-sources-3.19.2 and vanilla-sources-3.19.2: External USB 3 HDD: logical...
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: http://thread.gmane.org/gmane.linux.u...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-18 10:15 UTC by Marc Joliet
Modified: 2015-04-04 22:40 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Info on the relevant hardware (lsusb and lspci output). (hardware_info.txt,9.60 KB, text/plain)
2015-03-18 10:16 UTC, Marc Joliet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Joliet 2015-03-18 10:15:39 UTC
(Note: I originally wanted to report this directly to linux-usb-general, as per a recommendation on gentoo-user, but haven't gotten around to trying to reproduce this with vanilla-sources yet.  Once I do, I'll update this bug.)

The problem I'm facing is that the logical sector size on my external HDD is being incorrectly detected on initial connect.  The symptom that follows
from this is that the none of the partitions can be mounted.  I get the
following dmesg entries:

    # journalctl -k -b | grep sdg
    Mär 10 17:58:57 marcec kernel: sd 8:0:0:0: [sdg] Very big device. Trying to use READ CAPACITY(16).
    Mär 10 17:58:57 marcec kernel: sd 8:0:0:0: [sdg] 5860533160 512-byte logical blocks: (3.00 TB/2.72 TiB)
    Mär 10 17:58:57 marcec kernel: sd 8:0:0:0: [sdg] Write Protect is off
    Mär 10 17:58:57 marcec kernel: sd 8:0:0:0: [sdg] Mode Sense: 2b 00 00 00
    Mär 10 17:58:57 marcec kernel: sd 8:0:0:0: [sdg] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    Mär 10 17:58:57 marcec kernel: sd 8:0:0:0: [sdg] Very big device. Trying to use READ CAPACITY(16).
    Mär 10 17:58:57 marcec kernel:  sdg: sdg1 sdg2 sdg3
    Mär 10 17:58:57 marcec kernel: sd 8:0:0:0: [sdg] Very big device. Trying to use READ CAPACITY(16).
    Mär 10 17:58:57 marcec kernel: sd 8:0:0:0: [sdg] Attached SCSI disk
    Mär 10 18:00:33 marcec kernel: sd 9:0:0:0: [sdg] Very big device. Trying to use READ CAPACITY(16).
    Mär 10 18:00:33 marcec kernel: sd 9:0:0:0: [sdg] 732566645 4096-byte logical blocks: (3.00 TB/2.72 TiB)
    Mär 10 18:00:33 marcec kernel: sd 9:0:0:0: [sdg] Write Protect is off
    Mär 10 18:00:33 marcec kernel: sd 9:0:0:0: [sdg] Mode Sense: 2b 00 00 00
    Mär 10 18:00:33 marcec kernel: sd 9:0:0:0: [sdg] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    Mär 10 18:00:33 marcec kernel: sd 9:0:0:0: [sdg] 732566645 4096-byte logical blocks: (3.00 TB/2.72 TiB)
    Mär 10 18:00:33 marcec kernel:  sdg: sdg1 sdg2 sdg3
    Mär 10 18:00:33 marcec kernel: sd 9:0:0:0: [sdg] 732566645 4096-byte logical blocks: (3.00 TB/2.72 TiB)
    Mär 10 18:00:33 marcec kernel: sd 9:0:0:0: [sdg] Attached SCSI disk
    Mär 10 18:00:35 marcec kernel: BTRFS: device label MARCEC_BACKUP devid 1 transid 64666 /dev/sdg2
    Mär 10 18:00:35 marcec kernel: BTRFS info (device sdg2): disk space caching is enabled
    Mär 10 18:00:42 marcec kernel: EXT4-fs (sdg1): mounted filesystem with ordered data mode. Opts: (null)

I have to unplug it and plug it back in, after which it works correctly (as can
be seen in the log above).  It appears to be important that my PC has been cold
booted, as that is the only time when I can reliably reproduce this.  The
precise scenarios I have tested that *work* are:

- turning off the HDD (i.e., unplugging the AC) while leaving the PC on, then
  turning it back on several hours later, and

- rebooting my PC (while the HDD stays on).

I also tried it on my brother's Windows 8 PC, where the drive was correctly
detected and the FAT32 test partition was mounted (once Windows installed
drivers and whatnot; I did *not* install drivers manually). Moving it back to my
PC immediately afterwards did not show this problem.

Sadly, all that turned up in my online search were Ubuntu forum entries ([0] and
[1], both sans resolution).  They point to the firmware doing weird things for MBR compatibility, so one other thing I tried is to convert the MBR to GPT (using cgdisk), but it did not change anything.

If I'm unlucky, it's a firmware problem, but hope that it's something that can
be fixed in the relevant driver.

See also my thread at http://archives.gentoo.org/gentoo-user/message/5677e2044aba73c5ac046a2a634f801a.

[0] http://askubuntu.com/questions/337017/cant-read-partition-table-of-3tb-usb-disk
[1] http://ubuntuforums.org/showthread.php?t=1536933

Reproducible: Always

Steps to Reproduce:
1. Boot up PC (with USB3 drive attached)
Actual Results:  
Logical sector size is misdetected, mount fails.

Expected Results:  
Logical sector size is detected correctly, mount succeeds.

% emerge --info
Portage 2.2.14 (python 3.3.5-final-0, default/linux/amd64/13.0/no-emul-linux-x86/desktop, gcc-4.8.3, glibc-2.19-r1, 3.18.9-gentoo x86_64)
=================================================================
System uname: Linux-3.18.9-gentoo-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4200+-with-gentoo-2.2
KiB Mem:     4045880 total,    231184 free
KiB Swap:    4194300 total,   4193768 free
Timestamp of tree: Tue, 17 Mar 2015 21:45:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash:          4.2_p53
dev-java/java-config:     2.2.0
dev-lang/perl:            5.20.1-r4
dev-lang/python:          2.7.9-r1, 3.3.5-r1, 3.4.1
dev-util/cmake:           2.8.12.2-r1
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.11
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6-r1, 1.13.4
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.8.3
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.4
sys-devel/make:           4.1-r1
sys-kernel/linux-headers: 3.18 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo mjoliet science sunrise proaudio
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=y --nospinner --keep-going"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://de-mirror.org/distro/gentoo/ ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://mirror.muntinternet.net/pub/gentoo/"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-s -j3"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-9"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/marcec /var/lib/layman/science /var/lib/layman/sunrise /var/lib/layman/proaudio"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 avahi berkdb branding bzip2 cairo caps cdda cdinstall cdr cjk cli cracklib crypt css cups cxx dbus dga djvu dri dssi dts dvd dvdr emboss encode exif fbcon ffmpeg fftw firefox fish-completion flac fortran ftp fuse gdbm gif glamor gmp gnuplot gnutls gtk iconv idn imlib inotify ipv6 jack jackmidi jpeg jpeg2k kipi ladspa lapack lash latex lcms libnotify libsamplerate logrotate lzma mad mmx mmxext mng modplug modules mp3 mp4 mpeg multilib musepack musicbrainz ncurses nls nptl offensive ogg openexr opengl openmp opus osc pam pango pcre pdf plotutils png policykit ppds pulseaudio qt3support qt4 quicktime rar readline rtsp samba sasl session sid slang smp sndfile speex spell sse sse2 sse3 ssl startup-notification svg systemd taglib tcpd theora threads tiff timidity truetype udev udisks unicode upower usb vaapi vdpau vim-syntax vorbis vpx webkit wma x264 xattr xcb xcomposite xface xft xml xmp xpm xscreensaver xv xvid zeroconf zlib zsh-completion" ABI_X86="64" ALSA_CARDS="ice1724 hda-intel usb-audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx sse sse2 3dnow 3dnowext mmxext sse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_US en en_GB de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="radeon r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Comment 1 Marc Joliet 2015-03-18 10:16:49 UTC
Created attachment 399186 [details]
Info on the relevant hardware (lsusb and lspci output).
Comment 2 Marc Joliet 2015-03-22 10:08:05 UTC
OK, I tested with gentoo-sources-3.19.2 and then vanilla-sources-3.19.2, both of which exhibited the problem.  I also tried blacklisting the uas module, which didn't change anything, either.

Having tested with an upstream stable kernel, I should be able to post this to linux-usb-general now.
Comment 3 Marc Joliet 2015-03-22 13:24:44 UTC
OK, I posted this to linux-usb-general now.  See for example http://thread.gmane.org/gmane.linux.usb.general/124047.
Comment 4 Marc Joliet 2015-04-01 18:56:32 UTC
OK, so thanks to Alan Stern and Matthew Dharm, I now know that my problem most likely stems from interactions between the drive and the BIOS  The test I ran to determine this is

- unplug the drive
- turn on the computer
- plug the drive in once GRUB has started
- boot the kernel

after which the drive worked perfectly fine.  AFAICT, the BIOS does something that causes the drive to perform the aforementioned sector size translation.  So this seems to be something that cannot be fixed in the kernel, hence I think this bug can be closed.
Comment 5 Mike Pagano gentoo-dev 2015-04-04 22:40:38 UTC
Sorry to hear.Good luck.