public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
To: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Cc: "Dale R. Worley" <worley-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>,
	mdharm-usb-JGfshJpz5UybPZpvUQj5UqxOck334EZe@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Problem with USB-to-SATA adapters (was: AS2105-based enclosure size issues with >2TB HDDs)
Date: Wed, 03 Sep 2014 12:57:04 -0700	[thread overview]
Message-ID: <1409774224.6571.18.camel@jarvis.lan> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1409031459400.2156-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>

On Wed, 2014-09-03 at 15:05 -0400, Alan Stern wrote:
> On Wed, 3 Sep 2014, Dale R. Worley wrote:
> 
> > > From: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
> > > 
> > > On Fri, 29 Aug 2014, Matthew Dharm wrote:
> > > > Is there an 'easy' way to override the detected size of a storage
> > > > device from userspace?  If we had that, someone could write a helper
> > > > application which looked for this particular fubar and try to Do The
> > > > Right Thing(tm), or at least offer the user some options.
> > > 
> > > You mean, force a Media Change event and override the capacity reported 
> > > by the hardware?  I'm not aware of any API for doing that, although it 
> > > probably wouldn't be too hard to add one.
> > > 
> > > How would the user know what value to put in for the capacity?  Unless 
> > > the drive had been hooked up to a different computer and the user 
> > > manually noted the correct capacity and typed it in, it would have to 
> > > be guesswork.
> > 
> > The value would most sanely be extracted from the partition table.
> > (After verifying that the partition table looks correct.)  That seems
> > to be what Windows does, and it seems to work consistently enough for
> > Windows to trust that method.  Or at least, it could take the disk
> > size to be the end of the last partition, which would at least make
> > all the partitions accessible.
> 
> If there is a partition table.  It might be worthwhile to try an ATA 
> pass-through command as well.
> 
> > As somebody else hinted at, the userspace program could check the USB
> > device against a list of device types known to have this problem.
> > 
> > It could even verify that the SCSI-reported size matches the size
> > reported by the partition table (modulo two-to-the-whatever) (at least
> > for GPT tables, I don't know if MBR tables report the disk size).
> 
> They don't.  Just the start and end of each partition.
> 
> > Do we have any way of knowing what algorithm Windows uses in this
> > situation?
> 
> Ask Microsoft.  I suspect you're not likely to get an answer, though.
> 
> Anyway, I can try writing a patch to add this capability.  We'll see if 
> it can solve your problem.

Before we embark on elaborate hacks, why don't we just make the capacity
writeable (by root) in sysfs from userspace (will require block change)?
We can then encode all the nasty heuristics (including gpt reading) in
userspace as a udev rule.

James



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-09-03 19:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87801b450dee41dda169a3aa2dd2baf6@serv030.corp.eldorado.org.br>
     [not found] ` <87801b450dee41dda169a3aa2dd2baf6-CWPHn/M7kmRpAIlDVkCwMZnVvqcnFG0x9MRKq5+/VYY@public.gmane.org>
2014-08-25 13:16   ` AS2105-based enclosure size issues with >2TB HDDs Oliver Neukum
2014-08-25 14:24     ` Alan Stern
     [not found]       ` <Pine.LNX.4.44L0.1408251021560.1385-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-08-25 18:48         ` RES: " Alfredo Dal Ava Junior
     [not found]           ` <40601ab081d3451baf6267807659c80e-CWPHn/M7kmRpAIlDVkCwMZnVvqcnFG0x9MRKq5+/VYY@public.gmane.org>
2014-08-25 19:28             ` James Bottomley
2014-08-25 19:51               ` RES: " Alfredo Dal Ava Junior
     [not found]                 ` <175058921e084d26ba362fa6ecd7351c-CWPHn/M7kmRpAIlDVkCwMZnVvqcnFG0x9MRKq5+/VYY@public.gmane.org>
2014-08-25 20:21                   ` Alan Stern
2014-08-25 20:44                     ` RES: " Alfredo Dal Ava Junior
2014-08-25 21:16                     ` Oliver Neukum
2014-08-26 14:47                       ` Alan Stern
     [not found]                         ` <Pine.LNX.4.44L0.1408261031090.1434-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-08-27  6:45                           ` Oliver Neukum
2014-08-27 14:45                             ` Alan Stern
2014-08-26  9:58                     ` David Laight
     [not found]                       ` <063D6719AE5E284EB5DD2968C1650D6D1748130C-VkEWCZq2GCInGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2014-08-26 12:24                         ` Oliver Neukum
2014-08-26 12:53                           ` David Laight
2014-08-26 13:41                             ` RES: " Alfredo Dal Ava Junior
2014-08-25 19:33           ` Alan Stern
     [not found]             ` <Pine.LNX.4.44L0.1408251526390.1385-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-08-25 20:14               ` RES: " Alfredo Dal Ava Junior
     [not found]     ` <1408972618.10300.35.camel-B2T3B9s34ElbnMAlSieJcQ@public.gmane.org>
2014-08-26 19:39       ` Problem with USB-to-SATA adapters (was: AS2105-based enclosure size issues with >2TB HDDs) Dale R. Worley
2014-08-26 19:59         ` James Bottomley
2014-08-27 19:21           ` Dale R. Worley
2014-08-27 20:01             ` James Bottomley
2014-08-27 19:23           ` Dale R. Worley
2014-08-27 20:02             ` Alan Stern
2014-08-29 21:07               ` Dale R. Worley
2014-08-29 23:04                 ` Matthew Dharm
2014-08-30 21:15                   ` Alan Stern
2014-08-30 21:40                     ` Douglas Gilbert
     [not found]                       ` <540244D2.4030807-qazKcTl6WRFWk0Htik3J/w@public.gmane.org>
2014-08-31 14:13                         ` Alan Stern
     [not found]                     ` <Pine.LNX.4.44L0.1408301710120.4299-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-08-30 23:40                       ` Matthew Dharm
2014-09-03 19:17                         ` RES: " Alfredo Dal Ava Junior
2014-09-03 18:44                     ` Dale R. Worley
     [not found]                       ` <201409031844.s83IimIl011663-fKCv92Uu9G1eYiHQf5CFXGXnswh1EIUO@public.gmane.org>
2014-09-03 19:05                         ` Alan Stern
2014-09-03 19:50                           ` Dale R. Worley
     [not found]                           ` <Pine.LNX.4.44L0.1409031459400.2156-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-09-03 19:57                             ` James Bottomley [this message]
2014-09-03 20:30                               ` Alan Stern
     [not found]                                 ` <Pine.LNX.4.44L0.1409031625040.2156-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-09-03 22:07                                   ` James Bottomley
2014-09-05 17:32                                     ` Alan Stern
2014-09-04 20:49                               ` Dale R. Worley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409774224.6571.18.camel@jarvis.lan \
    --to=james.bottomley-d9phhud1jfjcxq6kfmz53/egyhegw8jk@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mdharm-usb-JGfshJpz5UybPZpvUQj5UqxOck334EZe@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    --cc=worley-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox