From owner-freebsd-usb@FreeBSD.ORG Tue Feb 19 22:00:25 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73E1B16A41B for ; Tue, 19 Feb 2008 22:00:25 +0000 (UTC) (envelope-from lukasz.sromek@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.234]) by mx1.freebsd.org (Postfix) with ESMTP id 1BB8913C4EE for ; Tue, 19 Feb 2008 22:00:24 +0000 (UTC) (envelope-from lukasz.sromek@gmail.com) Received: by wr-out-0506.google.com with SMTP id 68so1838990wri.3 for ; Tue, 19 Feb 2008 14:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=O0D4p9t/5nYNrREOynnrHeSNbCEObbTy5ut2RjWm7oI=; b=klAIJWg5a6naOuMAa9J2Hczuip5X60pImvABYOAbytU3WDU6d/Cs1fk2l4cHxR9br+I9ZEgPVFhTmC/Wq0A3nbI/PlkII8RdVImIwXUsoo8qQKdUODSi095Xd36b++7Zak6uZQZ38lQyNpLp+eumx0zOoMYWNkPghqTvglafSZI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=SKjHcgdKZc/z5a9P8gzdqFFuVWiZaFLIz/sNdYM5nnnhbjWhx7yo+GYOdcYSGDHBELVB812Sk+GwRztKrcg71nshUVHEP6p3FF0A3V+2V2uP0jk/QhnlwxWHoX1cNiEODQPmXDnsC9PMUTCzawCeTS/Rr+EBmWLlOufJ9yAzz0o= Received: by 10.114.39.16 with SMTP id m16mr5060818wam.146.1203458423348; Tue, 19 Feb 2008 14:00:23 -0800 (PST) Received: by 10.115.49.1 with HTTP; Tue, 19 Feb 2008 14:00:23 -0800 (PST) Message-ID: <32f529bc0802191400h29073d50xd23478a3389a4557@mail.gmail.com> Date: Tue, 19 Feb 2008 23:00:23 +0100 From: "=?ISO-8859-2?Q?=A3ukasz_Sromek?=" To: "Hans Petter Selasky" In-Reply-To: <200802191725.06156.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <32f529bc0802180102m6fa12e32x1903e3a8b98a70b3@mail.gmail.com> <200802181730.17473.hselasky@c2i.net> <32f529bc0802181358n3ac34ec2saa23bc658507ba8f@mail.gmail.com> <200802191725.06156.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: Copying to usb flash drive corrupts files X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2008 22:00:25 -0000 2008/2/19, Hans Petter Selasky : > Hi, > > Is this some kind of phone ? It's an old mp3 player. > > Have you tried to "fsck_msdosfs" the partition where the FAT filesystem > resides ? fsck indeed found some errors (Windows' scandisk didn't...), fixed them, but it didn't help. > > Maybe you could do like this: > > dd if=/dev/urandom of=/tmp/myrandomfile bs=65536 count=64 > > Then copy that file to the flash. "umount" and "mount". Then copy the file > back to your disk again. After that you do a: > > cat /tmp/myrandomfile | hexdump > /tmp/myrandomfile.txt > > Then you compare the two .txt files using "diff". > I did hexdump -v (because "Without the -v option, any number of groups of output lines, which would be identical to the immediately preceding group of output lines (except for the input offsets), are replaced with a line comprised of a single asterisk") And files seem to be very different! lukasz /tmp% diff /tmp/myrandomfile_usb.txt /tmp/myrandomfile.txt |wc -l 201790 Diffs begin at byte 00ae000 lukasz /tmp% diff /tmp/myrandomfile_usb.txt /tmp/myrandomfile.txt |head 44545,45056c44545,45056 < 00ae000 88ce bdf4 ff09 2b2c abc1 0846 8fea 0ea9 < 00ae010 71ac d09c ac15 396f e802 79f6 19dd 1b53 < 00ae020 774f 610b c637 ab27 ec5b 5d84 a9e5 f8d6 < 00ae030 8e70 daae 0bb0 b303 3a7d 5f9f 754e 3c18 < 00ae040 3ec9 324d 9c5c ead3 6e9a e174 a05b eab2 < 00ae050 aa66 d6a6 f41c 5762 ff0d 5145 890e c495 < 00ae060 2b86 9ede 5cc1 cde5 4ee2 4ff6 2aab e528 < 00ae070 b09a 7fb2 7e74 6601 bc63 e5f0 f240 6362 < 00ae080 ee9c 7902 fcfb 3438 d1fd 10c6 6c1d cab9 lukasz /tmp% diff /tmp/myrandomfile_usb.txt /tmp/myrandomfile.txt | grep \> |head > 00ae000 1e69 1cb8 fbcc d5f4 72c1 176f 0c70 b4b5 > 00ae010 ab99 a783 4c3c 53ab 2feb a027 8d2e a040 > 00ae020 4eb4 7d53 9590 0df4 d969 71b6 594f 9547 > 00ae030 a870 4321 8ec7 2b5f 698e 6373 61a0 55c2 > 00ae040 94f2 8705 87a7 e792 53e7 a022 b10d 734e > 00ae050 c9ae 31b7 b913 bd27 d0cc 27a9 8049 134c > 00ae060 e47c 02c5 6e49 854e 1f63 fe14 5b9c c028 > 00ae070 91a4 6cd3 98b8 cd6d 7366 03fe f54d 1a8a > 00ae080 0bec 8c6f 44fc 477c e372 5aa9 a5f4 fe3c > 00ae090 ec3a 830e 2820 ad62 858e 6edb ce39 d205 I guess you don't need whole diff output ;) After a while I reformatted the drive and tried the same test... With and without sync option: lukasz /tmp% diff myrandomfile.txt myrandomfile_usb_sync.txt |wc -l 491586 lukasz /tmp% diff myrandomfile.txt myrandomfile_usb_nosync.txt |wc -l 522242