All of lore.kernel.org
 help / color / mirror / Atom feed
* Change device block count from userspace?
@ 2018-04-16 10:24 Manuel Lauss
  2018-04-17 22:43 ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: Manuel Lauss @ 2018-04-16 10:24 UTC (permalink / raw)
  To: linux-block

Hello,

I have a SATA SSD which suddenly reports its size as 2.2TB, 0xFFFFFFFF
block count:

[   30.620086] sd 10:0:0:0: [sdc] 4294967295 512-byte logical blocks:
(2.20 TB/2.00 TiB)
[   30.620327] sd 10:0:0:0: [sdc] Write Protect is off
[   30.620329] sd 10:0:0:0: [sdc] Mode Sense: 43 00 00 00
[   30.620771] sd 10:0:0:0: [sdc] Write cache: enabled, read cache:
enabled, doesn't support DPO or FUA
[   34.170412] GPT:Primary header thinks Alt. header is not at the end
of the disk.
[   34.170413] GPT:4004704367 != 4294967294
[   34.170414] GPT:Alternate GPT header not at the end of the disk.
[   34.170414] GPT:4004704367 != 4294967294
[   34.170414] GPT: Use GNU Parted to correct GPT errors.
[   34.170419]  sdc: sdc1
[   34.172408] sd 10:0:0:0: [sdc] Attached SCSI disk
[   64.293698] sd 10:0:0:0: [sdc] tag#15 uas_eh_abort_handler 0
uas-tag 1 inflight: CMD IN
[   64.293702] sd 10:0:0:0: [sdc] tag#15 CDB: Read(10) 28 00 ff ff ff
00 00 00 08 00

It's impossible to access this device with either dd or any other
tools because apparently
the kernel tries to access higher blocks which, one after the other,
time out after around 5 minutes.  It's possible to access the disk on
Windows with an Ext4 driver, data seems fine but retrieval is very
slow.

Is there a way from userspace to tell the block layer that this device
has only 4004704368 blocks, and that it should not touch the higher
ones?

Thanks!
      Manuel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Change device block count from userspace?
  2018-04-16 10:24 Change device block count from userspace? Manuel Lauss
@ 2018-04-17 22:43 ` Martin K. Petersen
  2018-04-18  5:17   ` Manuel Lauss
  0 siblings, 1 reply; 4+ messages in thread
From: Martin K. Petersen @ 2018-04-17 22:43 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: linux-block


Manuel,

> I have a SATA SSD which suddenly reports its size as 2.2TB, 0xFFFFFFFF
> block count:

"Suddenly" as in out of the blue? Or after a drive firmware update? Or a
kernel ditto?

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Change device block count from userspace?
  2018-04-17 22:43 ` Martin K. Petersen
@ 2018-04-18  5:17   ` Manuel Lauss
  2018-04-20  1:37     ` Martin K. Petersen
  0 siblings, 1 reply; 4+ messages in thread
From: Manuel Lauss @ 2018-04-18  5:17 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: linux-block

On Wed, Apr 18, 2018 at 12:43 AM, Martin K. Petersen
<martin.petersen@oracle.com> wrote:
>
> Manuel,
>
>> I have a SATA SSD which suddenly reports its size as 2.2TB, 0xFFFFFFFF
>> block count:
>
> "Suddenly" as in out of the blue? Or after a drive firmware update? Or a
> kernel ditto?

Out of the blue, yes.  I think it's actually userspace (udev/udisks?)
which tries
to read a few block from the very end of the device, which confuses
the drive firmware.
Sometimes it recovers and then it can be mounted read-only without issues.
It's not a kernel fault, the drive is broken.

Still, is there a userspace option (sysfs attribute perhaps) to limit
disk capacity to
a certain block count?

Thank you!
     Manuel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Change device block count from userspace?
  2018-04-18  5:17   ` Manuel Lauss
@ 2018-04-20  1:37     ` Martin K. Petersen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2018-04-20  1:37 UTC (permalink / raw)
  To: Manuel Lauss; +Cc: Martin K. Petersen, linux-block


Manuel,

> It's not a kernel fault, the drive is broken.

Interesting, OK. Just wanted to make sure we didn't have a regression. I
tweaked the capacity reading code recently.

> Still, is there a userspace option (sysfs attribute perhaps) to limit
> disk capacity to a certain block count?

I'm afraid not.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-20  1:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16 10:24 Change device block count from userspace? Manuel Lauss
2018-04-17 22:43 ` Martin K. Petersen
2018-04-18  5:17   ` Manuel Lauss
2018-04-20  1:37     ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.