From owner-freebsd-hackers@freebsd.org Tue Jul 16 21:34:59 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D51EBBB04E for ; Tue, 16 Jul 2019 21:34:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 98C9776351 for ; Tue, 16 Jul 2019 21:34:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mailman.nyi.freebsd.org (Postfix) id 98423BB04D; Tue, 16 Jul 2019 21:34:59 +0000 (UTC) Delivered-To: hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97F4CBB04C for ; Tue, 16 Jul 2019 21:34:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B9A557634E for ; Tue, 16 Jul 2019 21:34:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id v22so15815645qkj.8 for ; Tue, 16 Jul 2019 14:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ln6HA7s00YCMCJv3L3Rp9oQswctk2i2KOicjLzGm6uI=; b=hGwqDcIZYlu3L9k7FFaRDaP4+Rp6w/KBRmXKt5UnOtVmxlDTum3LihS5W21a9KWV6k CO8eQKQKMB3AlzTO1/enNWvOX3r9GofIHstD0Khu5ET2Y0E2nfo9xOxqbJkE1bSTdrUG Srymi1qmaClC+H485d+y24bpmHDOUU+ecGf5jiUUYacPIV2yKVfl3gqH50mcbAzIuFUO 9HdU9ArSwfDXRUTrciTTQtQc66bk/HXbwrcZHHCwbRwLroxjB2jnZK1JwQQJZm02+4ad V42y7AH7e5DfjpV08Pf4GQf7yBcoBYg+Lf4IDKkx4U9rHp5k9ck61t+ezGNA73vZtB7Q V+bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ln6HA7s00YCMCJv3L3Rp9oQswctk2i2KOicjLzGm6uI=; b=FV7PuG/RcUNfoTIeLfW1zVYyYZgPRSopG3HFrEv7/+Lc/XWCsAlwJGcP9zKQdlcouB ipBVqpH5cCdjMQk3Er0bvSbJzR6bRyPq4KFmRc/4RZYzBQnGKorIGxFlTh5o3aDxcVgJ iR90InsBzIWbXWZ+0zFMn1L4sNaBZ7eKFWLiiFzy65Qv3o1Vs1ctGOG9vn5J/rDCFWx3 M48DByFDvgNU8nP2KNmocjxIPXhCGQ+2h+UChdning9MQlSnjKOitZJqfTkRsOkr+7PW Vh4PBN7G4iOK1i1l2JGB7tYNqKD1BXeBohGDuQ/2nNBz8YrJ4o8GYro7wav8ggGPnidi zL7w== X-Gm-Message-State: APjAAAXyHLgOfotIXAkpy6n+ML29F+DMAEzos6bpoadtKJw68k7aoZpm p84bDeCrLQPJcxzbyouoFB8sc8k//ejA4slP0W40lQ== X-Google-Smtp-Source: APXvYqy7NRHUCBR2LxtwwK2tOukgvrSavcs6PqDWK28WBjIK4Qb7maN8RumVP9Op9ZZps65UkOlgruJi0x3Gix0Rm5w= X-Received: by 2002:a37:9307:: with SMTP id v7mr13232112qkd.495.1563312898028; Tue, 16 Jul 2019 14:34:58 -0700 (PDT) MIME-Version: 1.0 References: <20190716182350.000054f8@gmail.com> <20190716224332.00000326@gmail.com> In-Reply-To: <20190716224332.00000326@gmail.com> From: Warner Losh Date: Tue, 16 Jul 2019 15:34:47 -0600 Message-ID: Subject: Re: Device's "stolen" sector To: =?UTF-8?B?RG9tYWdvaiBTbW9sxI1pxIc=?= Cc: Wojciech Puchar , "freebsd-hackers@freebsd.org" X-Rspamd-Queue-Id: B9A557634E X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=hGwqDcIZ X-Spamd-Result: default: False [-5.51 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.953,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[hackers@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; MX_GOOD(-0.01)[cached: ALT1.aspmx.l.google.com]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[d.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.53)[-0.528,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; FREEMAIL_TO(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+,1:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; IP_SCORE(-3.02)[ip: (-9.41), ipnet: 2607:f8b0::/32(-3.17), asn: 15169(-2.45), country: US(-0.06)]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jul 2019 21:34:59 -0000 On Tue, Jul 16, 2019 at 2:44 PM Domagoj Smol=C4=8Di=C4=87 wrote: > On Tue, 16 Jul 2019 13:27:43 -0600 > Warner Losh wrote: > > > On Tue, Jul 16, 2019 at 11:05 AM Wojciech Puchar > > wrote: > > > > > > > > > > > On Tue, 16 Jul 2019, Domagoj Smol=C4=8Di=C4=87 wrote: > > > > > > > 11.2-RELEASE-p9 > > > > > > > > Tested with >1 disks: > > > > -- > > > > SATA disk connected directly with SATA cable to MBO, shows > > > > correct > > > amount of sectors. > > > > diskinfo -v ada1 > > > > > > > > When I connect it to the same MBO over USB to SATA adapter, 1 > > > > sector is > > > missing (the last one) > > > > diskinfo -v da0 > > > > > > > > Having last sector inaccessible is a huge problem as many > > > > "things" use > > > it for a metadata. > > > > This has many times caused MBR disks occasionally to not be > > > > visible at > > > all while being 'da0' (gpart: No such geom: da0.) > > > > And also GPT disks to be in a [CORRUPT] state upon reattach > > > > directly to > > > SATA interface. > > > > > > > > Before submitting a bug, there is only 1 variable left that I > > > > can't > > > test, because I have only 1 USB to SATA adapter. > > > > It might be a hardware issue, so can someone else test this too? > > > > > > > i have two external disk chassis with USB-SATA bridge, works just > > > fine > > > > > > recently connected through it disk that was geli encrypted when > > > directly connected to server. geli worked so all is fine as geli > > > header is in last sector > > > > > > > It all depends... There's huge variation in the quality of USB-SATA > > bridges. Some get in the way and do things like round off the last > > sector when the reported capacity is odd, for example. Which is why > > I'm trying to see if there's an issue with that, or if the issue is > > something in the da driver. For drives with an even number of > > sectors, there's likely no issues at all... > > > > Warner > > > > Well, I've installed sysutils/sg3_utils, but required sg device will have > to wait, > as I can't recompile kernel ATM. > > Regarding quality ..., this one was so cheap that I've got it for free. ;= ) > Regarding capacity ..., HDD has EVEN number of sectors. > > Last HDD checked (just before posting) Hitachi: > =3D=3D=3D=3D=3D=3D=3D=3D > # diskinfo -v ada1 | awk '/mediasize in sectors/{print $1}' > 312581808 > > # gpart show -p ada1 > =3D> 63 312581745 ada1 MBR (149G) > 312581745 + 63 =3D 312581808 > > All OK! > > > # diskinfo -v da0 | awk '/mediasize in sectors/{print $1}' > 312581807 > > # gpart show -p da0 > gpart: No such geom: da0. > Showed nothing (usually it does even in this cases) > What does sg_readcap from sg3_utils package say? Warner