From owner-freebsd-hackers@freebsd.org Tue Jul 16 20:44:21 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 4D324B9F5C for ; Tue, 16 Jul 2019 20:44:21 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id E6048743B7 for ; Tue, 16 Jul 2019 20:44:20 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id E59A3B9F5B; Tue, 16 Jul 2019 20:44:20 +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 E55B8B9F5A for ; Tue, 16 Jul 2019 20:44:20 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) (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 28055743B5 for ; Tue, 16 Jul 2019 20:44:20 +0000 (UTC) (envelope-from rank1seeker@gmail.com) Received: by mail-ed1-x542.google.com with SMTP id r12so21918944edo.5 for ; Tue, 16 Jul 2019 13:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cSM0JCTszuZxjvWxThjsxEWya/KM4CJjWUtRdBWjnvU=; b=MOCPt8qinPPpAxQtiPWF1ASeDNs9d3MY7v9EzkfKPM1ywh5E2J5vIruGhvDbh/oSlJ 5CzCgzepprrnOorVk/0WWuaicUo8IqF+KkOVeNYuqFZmI3vSr39kuS25jX/oHwfgsjvS wJR/DyBk+iv6pWyBHRDlBz+s+5j9NGsn0YgTISJphRSQ1HCIEGAT3CSAw/5XfZUHcB0Q ZW9N25VCUq3oi40Xq9LVIJmvR0oqbPsxbPGiT8oQYdZWf0z6AJBFHkqXtpMdO4kwFy2s PgnjHL48VNgTwR5Nxc5y9iT+k/0Fmd2OS3cm5dyt0toxliixlB7tGUNpAmw3giRBemri SYlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cSM0JCTszuZxjvWxThjsxEWya/KM4CJjWUtRdBWjnvU=; b=HMmaDvMWk6yekrBpO9SGoQb1UEucZLykWyd7sPQZcd8k55ssxl7unH3YMOnFYXcnCt LgjLcLIQiwd1g7abunWLWEjFOgOyyfZe+AYQehSjPWCeD+2OfRKIIBmmGDCcvKWci75A yDQ246y6epLGCcTUajYFZ5AKng0sD3PhV0ajM9WkBFEDYa5GIzg3X+saXsWAXKqjvJJD JC5llIJ5KllnVe+0NZYfYOgW0JpdYkoTd9osflRQtc2k5I8xwITdw6/hbKYbmYbR8UpJ w9lPkeHe+tsxlJL+KjKa3xJGjDLWuj4+BuGh6bCR3YrzKoZWEvCsK7sPgoP/ta8MVBQr eZHA== X-Gm-Message-State: APjAAAXOjkyJfew64iZiukNG+TW+Aln1lphLchPFExxn/sZsdQIxUlog eh3jp3axQR3f+ZyK1XTmIHc= X-Google-Smtp-Source: APXvYqxB+fArMkWdmYeXUSw2bY8Ysyeln8Yfd57n10Fg0NLeWwNJldEMsdiAeIjPfJGYKMHTFzdZEQ== X-Received: by 2002:a17:907:20a6:: with SMTP id pw6mr17828351ejb.111.1563309859101; Tue, 16 Jul 2019 13:44:19 -0700 (PDT) Received: from localhost ([213.149.52.156]) by smtp.gmail.com with ESMTPSA id h15sm6436136edb.57.2019.07.16.13.44.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2019 13:44:18 -0700 (PDT) Date: Tue, 16 Jul 2019 22:43:32 +0200 From: Domagoj =?UTF-8?Q?Smol=C4=8Di=C4=87?= To: Warner Losh Cc: Wojciech Puchar , hackers@freebsd.org Subject: Re: Device's "stolen" sector Message-ID: <20190716224332.00000326@gmail.com> In-Reply-To: References: <20190716182350.000054f8@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: E6048743B7 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=MOCPt8qi; dmarc=pass (policy=none) header.from=gmail.com; spf=softfail (mx1.freebsd.org: 2610:1c1:1:606c::50:13 is neither permitted nor denied by domain of rank1seeker@gmail.com) smtp.mailfrom=rank1seeker@gmail.com X-Spamd-Result: default: False [-5.13 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; FORGED_RECIPIENTS_FORWARDING(0.00)[]; FORWARDED(0.00)[hackers@mailman.nyi.freebsd.org]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; SPF_FAIL_FORWARDING(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(0.00)[gmail.com,none]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; DMARC_POLICY_ALLOW_WITH_FAILURES(-0.50)[]; NEURAL_HAM_SHORT(-0.83)[-0.829,0]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; FORGED_RECIPIENTS(0.00)[imp@bsdimp.com ..,freebsd-hackers@freebsd.org]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_COUNT_FIVE(0.00)[6]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(-1.59)[ip: (-1.03), ipnet: 2610:1c1:1::/48(-3.90), asn: 11403(-2.99), country: US(-0.06)] 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 20:44:21 -0000 On Tue, 16 Jul 2019 13:27:43 -0600 Warner Losh wrote: > On Tue, Jul 16, 2019 at 11:05 AM Wojciech Puchar > wrote: >=20 > > > > > > On Tue, 16 Jul 2019, Domagoj Smol=C4=8Di=C4=87 wrote: > > =20 > > > 11.2-RELEASE-p9 > > > > > > Tested with >1 disks: > > > -- > > > SATA disk connected directly with SATA cable to MBO, shows > > > correct =20 > > amount of sectors. =20 > > > diskinfo -v ada1 > > > > > > When I connect it to the same MBO over USB to SATA adapter, 1 > > > sector is =20 > > missing (the last one) =20 > > > diskinfo -v da0 > > > > > > Having last sector inaccessible is a huge problem as many > > > "things" use =20 > > it for a metadata. =20 > > > This has many times caused MBR disks occasionally to not be > > > visible at =20 > > all while being 'da0' (gpart: No such geom: da0.) =20 > > > And also GPT disks to be in a [CORRUPT] state upon reattach > > > directly to =20 > > SATA interface. =20 > > > > > > Before submitting a bug, there is only 1 variable left that I > > > can't =20 > > test, because I have only 1 USB to SATA adapter. =20 > > > It might be a hardware issue, so can someone else test this too? > > > =20 > > 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 > > =20 >=20 > 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... >=20 > Warner >=20 Well, I've installed sysutils/sg3_utils, but required sg device will have t= o 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) Domagoj Smol=C4=8Di=C4=87