From owner-freebsd-usb@freebsd.org  Sun Dec  1 02:03:16 2019
Return-Path: <owner-freebsd-usb@freebsd.org>
Delivered-To: freebsd-usb@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 1BE551C2375
 for <freebsd-usb@mailman.nyi.freebsd.org>;
 Sun,  1 Dec 2019 02:03:16 +0000 (UTC)
 (envelope-from anatoly@kazanfieldhockey.ru)
Received: from kazanfieldhockey.ru (kazanfieldhockey.ru [78.138.152.250])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "kazanfieldhockey.ru", Issuer "System Administrator" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id 47QWjv01s8z3Lg4
 for <freebsd-usb@freebsd.org>; Sun,  1 Dec 2019 02:03:14 +0000 (UTC)
 (envelope-from anatoly@kazanfieldhockey.ru)
Received: from asd2 (host-175-22.static.telecet.ru [87.117.175.22] (may be
 forged)) (authenticated bits=0)
 by kazanfieldhockey.ru (8.15.2/8.15.2) with ESMTPSA id xB11vBab005121
 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO)
 for <freebsd-usb@freebsd.org>; Sun, 1 Dec 2019 04:57:13 +0300 (MSK)
 (envelope-from anatoly@kazanfieldhockey.ru)
Date: Sun, 1 Dec 2019 05:03:41 +0300
From: Anatoly <anatoly@kazanfieldhockey.ru>
To: freebsd-usb@freebsd.org
Subject: Re: pendrive clone impossible ?
Message-ID: <20191201050341.4a02879a@asd2>
In-Reply-To: <CAFYkXj=8md=Lv-N9CLLZ=kU+aEE8VZGVu=3kQTWnvqbGi6tmQA@mail.gmail.com>
References: <CAFYkXjkHobPfNwCL3ssL98TgUjE=jvojXACH+iR0EV-tzK-pxA@mail.gmail.com>
 <20191130223322.1028feab.freebsd@edvax.de>
 <CAFYkXjk3HOmfXkd=L2CYpbV9=YmzP_dP1RxS37D817iW_Bqftg@mail.gmail.com>
 <20191130234900.81464b43.freebsd@edvax.de>
 <CAFYkXj=8md=Lv-N9CLLZ=kU+aEE8VZGVu=3kQTWnvqbGi6tmQA@mail.gmail.com>
X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; amd64-portbld-freebsd10.2)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2
 (kazanfieldhockey.ru [192.168.13.2]); Sun, 01 Dec 2019 04:57:14 +0300 (MSK)
X-Rspamd-Queue-Id: 47QWjv01s8z3Lg4
X-Spamd-Bar: ++++
Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none;
 spf=none (mx1.freebsd.org: domain of anatoly@kazanfieldhockey.ru has no SPF
 policy when checking 78.138.152.250)
 smtp.mailfrom=anatoly@kazanfieldhockey.ru
X-Spamd-Result: default: False [4.84 / 15.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[];
 TO_MATCH_ENVRCPT_ALL(0.00)[];
 IP_SCORE(0.78)[asn: 28840(3.87), country: RU(0.01)];
 MIME_GOOD(-0.10)[text/plain];
 PREVIOUSLY_DELIVERED(0.00)[freebsd-usb@freebsd.org];
 TO_DN_NONE(0.00)[]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1];
 NEURAL_SPAM_MEDIUM(0.68)[0.675,0]; MIME_TRACE(0.00)[0:+];
 NEURAL_SPAM_LONG(0.99)[0.993,0];
 DMARC_NA(0.00)[kazanfieldhockey.ru]; R_SPF_NA(0.00)[];
 FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[];
 SUBJECT_ENDS_QUESTION(1.00)[];
 ASN(0.00)[asn:28840, ipnet:78.138.128.0/19, country:RU];
 MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[];
 RCVD_COUNT_TWO(0.00)[2]
X-BeenThere: freebsd-usb@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FreeBSD support for USB <freebsd-usb.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-usb>,
 <mailto:freebsd-usb-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-usb/>
List-Post: <mailto:freebsd-usb@freebsd.org>
List-Help: <mailto:freebsd-usb-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-usb>,
 <mailto:freebsd-usb-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 01 Dec 2019 02:03:16 -0000

On Sun, 1 Dec 2019 00:29:13 +0100
Tomasz CEDRO <tomek@cedro.info> wrote:

> but I have no more time to play, so I leave a trace if
> someone meets similar issues in future :-)

I've had a problem in the past with one of the first 32GB pendrives.
Not quite similar problem, but may it be buggy RAM cache
implementation too? What if:
- Write sector(s)
- usbconfig -d <your_bus>.<your_dev> power_off
- usbconfig -d <your_bus>.<your_dev> power_on
- Read and compare.

As you saying some writes was succeful, some not. May it
depend not on source of that bytes or their content, but on time passed
between write and read?

It turns out that Transcend pendrive I've got in 2010 had RAM cache
(didn't remember exact cache size I measured out, as I remember
something around 128K-512K), and all writes was cached. This amazingly
speeds up random R/W fs operations in comparation with similar
pendrives of those years, but I constantly losing the data and getting
fs corrupted when used it with OSes that do not "power_off" or
"suspend" that drive before I pull of it out of the socket.